From nobody Mon Apr 29 10:47:01 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1571220610; cv=none; d=zoho.com; s=zohoarc; b=PMy4FpUNUGuafAfNZapV3zFvAlIb9xzi3QsjPpUf0NGnsGUbo2coIQWLelRYGZ93m1kgkOsYS6/PZdPW7QynBZC3/IxgShCfl+g0EQTx08F/GWK3XnAeAyLYY3mtlyjhDa35g8T+pbb9pGruhxRfb3bF04tbE4HOwrjO9w4wFCk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571220610; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=yDm9DsJRCD+QyZsBw6jXVs4S8dZXmypef4WZOF+hxLI=; b=dRmnFvfuVCRBOldfDW1ZpVmKTJDKvgJlak9l+1mI+WRQOLTNjLYuT2ex7VZU0GaEy0IPvTIzG/9RKE3c9KT3NJ0x5TvYf+aIcFa6OpbHxxbC6E7edJKicDod+xLQDClHl3GjB2/Kqyey7ALE+6p0j+4VMtXJoRG1A4WcKx6HfG0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1571220610457264.01129273343577; Wed, 16 Oct 2019 03:10:10 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iKgEG-0006Xa-N2; Wed, 16 Oct 2019 10:08:28 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iKgEE-0006XV-K8 for xen-devel@lists.xenproject.org; Wed, 16 Oct 2019 10:08:26 +0000 Received: from mail-lj1-x244.google.com (unknown [2a00:1450:4864:20::244]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id e419fd68-effc-11e9-beca-bc764e2007e4; Wed, 16 Oct 2019 10:08:25 +0000 (UTC) Received: by mail-lj1-x244.google.com with SMTP id d1so23306305ljl.13 for ; Wed, 16 Oct 2019 03:08:25 -0700 (PDT) Received: from otyshchenko.kyiv.epam.com (ll-22.209.223.85.sovam.net.ua. [85.223.209.22]) by smtp.gmail.com with ESMTPSA id v21sm1317853lfi.22.2019.10.16.03.08.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Oct 2019 03:08:23 -0700 (PDT) X-Inumbo-ID: e419fd68-effc-11e9-beca-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Ey0gJAWT8ZHXWHmoB9yq8/ELLpfh8IwG0AKsCTAprZA=; b=JmNPddfFfv5pCC+/lAcIzqQnkTjpWlv4W8wL7oOf/auYQxxC+kkHsm9Z4/V3LhIMPU e7fjyGdFk8y1GI0Cr+q6H3YfQk2WOn3kbAdwJXl1SHtWLIQVeGB4EA0pdxm38jVUoOsE hHgM1c1mzJdUrBNY4t0D0s/vcSwCfp4qEDjFNC1GVFX5lzUcY/q3BA9irx85ms7tk3CI OFmq56mmlmCYKhAW9NkJuYPn3aUiCSon0b5Pqt7PWZoC2MZzXz3kMj1ohAeNHVvxkpd6 QhfUZ03B5B9JWdu4pPsaR512YLSV1NCUTpmqxIbMNQjDGQ4YDs537g+BjQytaRlA8n1p KHBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Ey0gJAWT8ZHXWHmoB9yq8/ELLpfh8IwG0AKsCTAprZA=; b=GRTUr/n7WttRH0smhGWUbfhPns3W7LhoMN73cmwfJ4bWCsoHyuPMRq7zXiGiBn4dQ1 gZ3Ioe01bY4FxeymxIEg0E3/DK2M3/r7Aff+rr/AVod1l11wW7RsZR490o6KNtfz4TIg RMAyA6V3rCZvN5B8MdeggfOczf7JmQ059sfcn7GFgaLPp9qL4Y/NtGxopF2+TksjxuQ3 qhyK+sMzNa7E89koyFyteJs/wgcNJpx3tuK3WLQ22NHWZpErBHjFiGPCw5HBCQ0fAMKL g7HGfvS10JJGqk3PbMpteCbNnG5BX38aeBanU7cW3fuhgQs78lUTTfm+keRQOU20lHFX Sa8w== X-Gm-Message-State: APjAAAWz8+PNU7Y8FNibPO7ty4CRH1T/Y7ZZEIehfMl7+ZT34r8h4UYL 4PsK1VAjCs5qU7UZ66P2NbdbI7NZhQc= X-Google-Smtp-Source: APXvYqzHyfI3OGKzeRz4S0M5sUsa4ScSrntLphRHvDCcuAcss99g8jbSAOa/uwmg8oRFVbEFElSjgA== X-Received: by 2002:a2e:a166:: with SMTP id u6mr25419005ljl.209.1571220504183; Wed, 16 Oct 2019 03:08:24 -0700 (PDT) From: Oleksandr Tyshchenko To: xen-devel@lists.xenproject.org Date: Wed, 16 Oct 2019 13:08:07 +0300 Message-Id: <1571220487-6582-1-git-send-email-olekstysh@gmail.com> X-Mailer: git-send-email 2.7.4 Subject: [Xen-devel] [PATCH for-4.13 v3] xen/arm: domain_build: Don't expose IOMMU specific properties to hwdom X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: jgross@suse.com, Oleksandr Tyshchenko , julien.grall@arm.com, sstabellini@kernel.org, volodymyr_babchuk@epam.com MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Oleksandr Tyshchenko We always skip the IOMMU device when creating DT for hwdom if there is an appropriate driver for it in Xen (device_get_class(iommu_node) returns DEVICE_IOMMU). So, even if it is not used by Xen it will be skipped. We should also skip the IOMMU specific properties of the master device behind that IOMMU in order to avoid exposing an half complete IOMMU bindings to hwdom. According to the Linux's docs: 1. Documentation/devicetree/bindings/iommu/iommu.txt 2. Documentation/devicetree/bindings/pci/pci-iommu.txt Signed-off-by: Oleksandr Tyshchenko Acked-by: Julien Grall --- Changes V2 [2] -> V3: - Gather two conditions in one "if" - Clarify patch subject/comment in code Changes V1 [1] -> V2: - Only skip IOMMU specific properties of the master device if we skip the corresponding IOMMU device - Use "hwdom" over "Dom0" [1] https://lists.xenproject.org/archives/html/xen-devel/2019-10/msg00104.h= tml [2] https://lists.xenproject.org/archives/html/xen-devel/2019-10/msg00673.h= tml --- xen/arch/arm/domain_build.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 1d5eac9..6e85ef4 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -480,10 +480,25 @@ static int __init write_properties(struct domain *d, = struct kernel_info *kinfo, const struct dt_property *prop, *status =3D NULL; int res =3D 0; int had_dom0_bootargs =3D 0; + struct dt_device_node *iommu_node; =20 if ( kinfo->cmdline && kinfo->cmdline[0] ) bootargs =3D &kinfo->cmdline[0]; =20 + /* + * We always skip the IOMMU device when creating DT for hwdom if there= is + * an appropriate driver for it in Xen (device_get_class(iommu_node) + * returns DEVICE_IOMMU). + * We should also skip the IOMMU specific properties of the master dev= ice + * behind that IOMMU in order to avoid exposing an half complete IOMMU + * bindings to hwdom. + * Use "iommu_node" as an indicator of the master device which propert= ies + * should be skipped. + */ + iommu_node =3D dt_parse_phandle(node, "iommus", 0); + if ( iommu_node && device_get_class(iommu_node) !=3D DEVICE_IOMMU ) + iommu_node =3D NULL; + dt_for_each_property_node (node, prop) { const void *prop_data =3D prop->value; @@ -540,6 +555,19 @@ static int __init write_properties(struct domain *d, s= truct kernel_info *kinfo, continue; } =20 + if ( iommu_node ) + { + /* Don't expose IOMMU specific properties to hwdom */ + if ( dt_property_name_is_equal(prop, "iommus") ) + continue; + + if ( dt_property_name_is_equal(prop, "iommu-map") ) + continue; + + if ( dt_property_name_is_equal(prop, "iommu-map-mask") ) + continue; + } + res =3D fdt_property(kinfo->fdt, prop->name, prop_data, prop_len); =20 if ( res ) --=20 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel