From nobody Tue Jun 28 07:53:12 2022 X-Original-To: dev-commits-src-all@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 47585866E46; Tue, 28 Jun 2022 07:53:13 +0000 (UTC) (envelope-from git@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 4LXGzs14W8z4g9p; Tue, 28 Jun 2022 07:53:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656402793; 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; bh=8C1kYGJy2xi2bKzx2WExILZ9gJNA7WID84aRKYGk5W0=; b=SP44Yrpg02BU0q6YChKeH/CcTnNWXo4Ioc735TNJtWTszjxBL4msJf1lj+xJnneqRQGwRI hV6MAondKL441mJWjEtx8vdajRdwym5GgVAVLC4Msvn7bDMnUW5wzJ6XVzasZl7w+kcFQC 2+H3XGbEZ3wDHlrBp4//c9v5TxxUELJ3wDdxST3vQPpOaCoDy92m9egkj2yv601pM5TXlf CKr7PI0auZBye/Z/DKjC0NN3rGdIqT0B616HVTPevnihqASgz62nVymBOf1M6GalmcVPRC MyBSNAjRsS/XRCrEL6Di0HLR9QRx4WyV6nMsA/43g7Vi1rNmztnIN6B6R8TddQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 04D71192CC; Tue, 28 Jun 2022 07:53:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25S7rCtM028913; Tue, 28 Jun 2022 07:53:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25S7rCKv028912; Tue, 28 Jun 2022 07:53:12 GMT (envelope-from git) Date: Tue, 28 Jun 2022 07:53:12 GMT Message-Id: <202206280753.25S7rCKv028912@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Roger=20Pau=20Monn=C3=A9?= Subject: git: 091febc04a5d - main - xen/blkback: do not use x86 CPUID in generic code List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 091febc04a5d5065fe633fe29c11f008dc392ab8 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656402793; 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; bh=8C1kYGJy2xi2bKzx2WExILZ9gJNA7WID84aRKYGk5W0=; b=bnY5SWGT/6fEvNrcJ03Nvcg9jnE9KBQJEY11tepSUJvE0Vm7fC/1Ro2iRBOIJhkQIS4Ugg yA2yXqRzKG9OTXlDcJ2+s1Koy/ZTITYDRgbvVthjSvEUL5qBAXuzZmdKCvcIwHOyqCuNSJ B/Qq3rBU14DhChoIqqWPFJuAnEDfemngICQaUsAnH0XSKvvkyYtMSMrnC4AmqUOidcYejP s6LxEEfICr1lFA5mKvU+YN2iKDDJ5jlEAeOh71MUKOUjzDJResoeQYUAolBEz22kcMAZf4 +Nm37mid2s+sAWiVLAGpMaLsLbVoaQ7DLI06ZzQn0h414iyISoxOBlXnSS2mrw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656402793; a=rsa-sha256; cv=none; b=sx7D/YDxYhXQ4a7f1Q7eHJ85TAcFy6y+kIe2DSydwHGbkEbP0WjcYgCjVgk3HtrYf/Kjht OOOjuCmbIHKzTqG5jMFwiM8ZaIiqR/cUahj1y6t/oVqTKu0QKovC5ne84IlMg3pHN/Qs3E cPs376CpUxSE88+3XsBIJydMFZXn5JGba7hHsvPmgbfubon5SznxeVwQ6JjWhW/7EYDCzt NBh55tfWw1VzlryK6DAtIpzmeecNZOkYy2QvGkxk2X3KcQDpIPb3LZZCe2IRmKNvtzBYny eBRuoI/QmCnKiI6iA2dIS1WaWJoFmYzt/8l1SCbGGZ5CHeME6UbVAI3yMoUTfg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=091febc04a5d5065fe633fe29c11f008dc392ab8 commit 091febc04a5d5065fe633fe29c11f008dc392ab8 Author: Roger Pau Monné AuthorDate: 2022-06-17 13:29:05 +0000 Commit: Roger Pau Monné CommitDate: 2022-06-28 07:51:57 +0000 xen/blkback: do not use x86 CPUID in generic code Move checker for whether Xen creates IOMMU mappings for foreign pages into a helper that's defined in arch-specific code. Reported by: Elliott Mitchell Fixes: 1d528f95e8ce ('xen/blkback: remove bounce buffering mode') Sponsored by: Citrix Systems R&D --- sys/dev/xen/blkback/blkback.c | 7 +------ sys/x86/include/xen/xen-os.h | 2 ++ sys/x86/xen/hvm.c | 11 +++++++++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/sys/dev/xen/blkback/blkback.c b/sys/dev/xen/blkback/blkback.c index b15dbb1e9155..bd550695e719 100644 --- a/sys/dev/xen/blkback/blkback.c +++ b/sys/dev/xen/blkback/blkback.c @@ -80,7 +80,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -3318,16 +3317,12 @@ xbb_attach_failed(struct xbb_softc *xbb, int err, const char *fmt, ...) static int xbb_probe(device_t dev) { - uint32_t regs[4]; if (strcmp(xenbus_get_type(dev), "vbd")) return (ENXIO); - KASSERT(xen_cpuid_base != 0, ("Invalid base Xen CPUID leaf")); - cpuid_count(xen_cpuid_base + 4, 0, regs); - /* Only attach if Xen creates IOMMU entries for grant mapped pages. */ - if (!(regs[0] & XEN_HVM_CPUID_IOMMU_MAPPINGS)) { + if (!xen_has_iommu_maps()) { static bool warned; if (!warned) { diff --git a/sys/x86/include/xen/xen-os.h b/sys/x86/include/xen/xen-os.h index 4d4aa64955ba..861ad10e3d78 100644 --- a/sys/x86/include/xen/xen-os.h +++ b/sys/x86/include/xen/xen-os.h @@ -72,6 +72,8 @@ xen_pv_nics_disabled(void) return (xen_hvm_domain() && xen_disable_pv_nics != 0); } +bool xen_has_iommu_maps(void); + #endif /* !__ASSEMBLY__ */ #endif /* _MACHINE_X86_XEN_XEN_OS_H_ */ diff --git a/sys/x86/xen/hvm.c b/sys/x86/xen/hvm.c index 544b6e6439e8..8d25e35e5151 100644 --- a/sys/x86/xen/hvm.c +++ b/sys/x86/xen/hvm.c @@ -489,3 +489,14 @@ xen_hvm_cpu_init(void) DPCPU_SET(vcpu_info, vcpu_info); } SYSINIT(xen_hvm_cpu_init, SI_SUB_INTR, SI_ORDER_FIRST, xen_hvm_cpu_init, NULL); + +bool +xen_has_iommu_maps(void) +{ + uint32_t regs[4]; + + KASSERT(xen_cpuid_base != 0, ("Invalid base Xen CPUID leaf")); + cpuid_count(xen_cpuid_base + 4, 0, regs); + + return (regs[0] & XEN_HVM_CPUID_IOMMU_MAPPINGS); +}