From nobody Thu Mar 24 15:26:56 2022 X-Original-To: virtualization@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CD2A41A3D31B for ; Thu, 24 Mar 2022 15:26:56 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KPTbh3gKvz4ZrJ for ; Thu, 24 Mar 2022 15:26:56 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 552C11A893 for ; Thu, 24 Mar 2022 15:26:56 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 22OFQu4L075297 for ; Thu, 24 Mar 2022 15:26:56 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from bugzilla@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 22OFQupc075296 for virtualization@FreeBSD.org; Thu, 24 Mar 2022 15:26:56 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: bugzilla set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: virtualization@FreeBSD.org Subject: [Bug 260178] bhyve: passthru makes ahci-hd boot fail Date: Thu, 24 Mar 2022 15:26:56 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bhyve X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: bhyve X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: commit-hook@FreeBSD.org X-Bugzilla-Status: In Progress X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: virtualization@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Discussion List-Archive: https://lists.freebsd.org/archives/freebsd-virtualization List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-virtualization@freebsd.org X-BeenThere: freebsd-virtualization@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648135616; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ICwmDtMisfClKmReKMoFVCwCVOWK8Cag0+Brw1gxcu8=; b=LHe5lzlXIFhMOjRxGYGX2JU7Y8rXZHpZkkRGbNeKhR34OaqwMiIClIznsEfcUvIIMr3VRy hr0DV4WaQEcwQMUpUsB/Mdq6+gfLi6SqeLKoOGdhkSnzE06DCterMVUlKKi9Mp6bPL65+Q fyCAL5yf68q49/BkEaGFcQnQDU/6mbGGaQs8AQ3zCnIWJN9HmLEWWdOkv5G6yiDa6pGMQs OkQM8eEJdRccOQ20qSHwM5gP5aquZqSawekz9jKKpJqgwfRopOY97bznRn6PWSvFrtQeOm gf9QMncQKb7gsvPN6PKlyMgZq5kuLgNpI/CiOOp2Rz+fFUQkB+OpwiIC92fMUg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648135616; a=rsa-sha256; cv=none; b=B7QZyrSLdJyF4NRi8z9QucZyVzUvZyBdcDTxW+H0y3gvB/0FYN2LC8OWK6HRRgZdA6gFFZ 6nbk03F05nnczbwcn5N5fvQNxdNVxofTd299/icjWWWHvUCW6M9g+MDPV9/zd8CEXPKZVT ET1e1yd6CctXbMCVIm+kAwxqsW2RDV/qdtighWm7uvcC+DrIBI8XZKuu9Aqs4Z1ZwAS5mV wx+xtwdsiIwuOWzvs3NIz+Q8Um1dUxAY0KGKbJZtkQ4nshtdekDCNFyu0HlYiQTR2Cs4rq E9/U02PPCOaTwMuFZ/4Xh8TSTuFPy1yrv3oaDDIvLdiocHKPiSilhx8jG62KoQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D260178 --- Comment #11 from commit-hook@FreeBSD.org --- A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3D246c398145674e4a9337fd933a6e6da7f= 160118e commit 246c398145674e4a9337fd933a6e6da7f160118e Author: Bjoern A. Zeeb AuthorDate: 2022-03-18 20:39:06 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-03-24 15:21:24 +0000 bhyve: Do not remove guest physical addresses from IOMMU host domain This permits I/O devices on the host to directly access wired memory dedicated to guests using passthru devices. Note that wired memory belonging to guests that do not use passthru devices has always been accessible by I/O devices on the host. bhyve maps guest physical addresses into the user address space of the bhyve process by mmap'ing /dev/vmm/. Device models pass pointers derived from this mapping directly to system calls such as preadv() to minimize copies when emulating DMA. If the backing store for a device model is a raw host device (e.g. when exporting a raw disk device such as /dev/ada as a drive in the guest), the host device driver (e.g. ahci for /dev/ada) can itself use DMA on the host directly to the guest's memory. However, if the guest's memory is not present in the host IOMMU domain, these DMA requests by the host device will fail without raising an error visible to the host device driver or to the guest resulting in non-working I/O in the guest. It is unclear why guest addresses were removed from the IOMMU host doma= in initially, especially only for VM's with a passthru device as the host IOMMU domain does not affect the permissions of passthru devices, only devices on the host. A considered alternative was using bounce buffers instead (D34535 is a proof of concept), but that adds additional overhead for unclear benefit. This solves a long-standing problem when using passthru devices and physical disks in the same VM. Thanks to: grehan (patience and help) Thanks to: jhb (for improving the commit message) PR: 260178 Reviewed by: grehan, jhb MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D34607 sys/amd64/vmm/vmm.c | 2 -- 1 file changed, 2 deletions(-) --=20 You are receiving this mail because: You are the assignee for the bug.=