From nobody Mon Feb 9 05:41:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1593862418; cv=none; d=zohomail.com; s=zohoarc; b=S+rYIyJd/r73z1Bs4/gk7S/EE2gxBwDYmKu45GBjrqWjj4nS5PylJoqmc8dmZrT7Ildcjvy6yuUncmuMxh2bON46dKFwerx3PxIsxn5/aFub3ePsL8dd60hnlqQdnI8qsfJ+tNbubsSATBpU0xqVeRCOE8lHNG/sHo9fm/B8IzU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593862418; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=ZeFnNqsBe57iIcXB1JXQZRYOaeOsnRPmAC4rWEc0/+8=; b=cLhoD4rTyolocdcwceWVMaMxnGvSQ2NGfdRaXAy6N0IOE/0y8MRP2f3vFVx5BWttrzCIXi1rX8HDgamb7YK+VkA2BNCnsdb+DjHEkhDx+RhZZX3CW2P0uWDRdxkBMvxHQf48DdgIXF9Y17wSA41Kk+jykT1/bgE2XZbKLfEuzOE= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1593862418153138.85914654804617; Sat, 4 Jul 2020 04:33:38 -0700 (PDT) Received: from localhost ([::1]:57460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jrgQK-0005iY-QS for importer@patchew.org; Sat, 04 Jul 2020 07:33:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52408) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jrgNG-0000WP-7u for qemu-devel@nongnu.org; Sat, 04 Jul 2020 07:30:26 -0400 Received: from mga05.intel.com ([192.55.52.43]:24797) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jrgNE-0004KM-8K for qemu-devel@nongnu.org; Sat, 04 Jul 2020 07:30:25 -0400 Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jul 2020 04:30:16 -0700 Received: from jacob-builder.jf.intel.com ([10.7.199.155]) by fmsmga007.fm.intel.com with ESMTP; 04 Jul 2020 04:30:16 -0700 IronPort-SDR: 8p0V7SBC4TfMnBuY5bsEUYQPBTz3oH5mvW15sJuy7tpuyilvXBhrOawBGMySfyNF5N02vLMdsa NnvEqhs/HX4A== X-IronPort-AV: E=McAfee;i="6000,8403,9671"; a="232105519" X-IronPort-AV: E=Sophos;i="5.75,311,1589266800"; d="scan'208";a="232105519" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False IronPort-SDR: KfyhITJieKBUkJKVUi6IK5pBB4TJlEyGXvpQ/B54+8iTwPS6xcEgPE/wJGvWXSm2rgRaV0UfIS Hnf/+XYOFbtQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,311,1589266800"; d="scan'208";a="266146779" From: Liu Yi L To: qemu-devel@nongnu.org, alex.williamson@redhat.com, peterx@redhat.com Subject: [RFC v7 05/25] intel_iommu: add get_iommu_attr() callback Date: Sat, 4 Jul 2020 04:36:29 -0700 Message-Id: <1593862609-36135-6-git-send-email-yi.l.liu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1593862609-36135-1-git-send-email-yi.l.liu@intel.com> References: <1593862609-36135-1-git-send-email-yi.l.liu@intel.com> Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.55.52.43; envelope-from=yi.l.liu@intel.com; helo=mga05.intel.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/04 07:30:14 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jean-philippe@linaro.org, kevin.tian@intel.com, yi.l.liu@intel.com, Yi Sun , Eduardo Habkost , kvm@vger.kernel.org, mst@redhat.com, jun.j.tian@intel.com, eric.auger@redhat.com, yi.y.sun@intel.com, Jacob Pan , pbonzini@redhat.com, hao.wu@intel.com, jasowang@redhat.com, Richard Henderson , david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Return vIOMMU attribute to caller. e.g. VFIO call via PCI layer. Cc: Kevin Tian Cc: Jacob Pan Cc: Peter Xu Cc: Yi Sun Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost Signed-off-by: Liu Yi L --- hw/i386/intel_iommu.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index ca6dcad..2d6748f 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -3441,6 +3441,28 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s,= PCIBus *bus, int devfn) return vtd_dev_as; } =20 +static int vtd_dev_get_iommu_attr(PCIBus *bus, void *opaque, int32_t devfn, + IOMMUAttr attr, void *data) +{ + int ret =3D 0; + + assert(0 <=3D devfn && devfn < PCI_DEVFN_MAX); + + switch (attr) { + case IOMMU_WANT_NESTING: + { + bool *pdata =3D data; + + /* return false until vSVA is ready */ + *pdata =3D false; + break; + } + default: + ret =3D -ENOENT; + } + return ret; +} + static uint64_t get_naturally_aligned_size(uint64_t start, uint64_t size, int gaw) { @@ -3736,6 +3758,7 @@ static AddressSpace *vtd_host_dma_iommu(PCIBus *bus, = void *opaque, int devfn) =20 static PCIIOMMUOps vtd_iommu_ops =3D { .get_address_space =3D vtd_host_dma_iommu, + .get_iommu_attr =3D vtd_dev_get_iommu_attr, }; =20 static bool vtd_decide_config(IntelIOMMUState *s, Error **errp) --=20 2.7.4