From: kbuild test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH v13 3/8] iommu/vt-d: Add nested translation helper function
Date: Sat, 16 May 2020 05:11:59 +0800 [thread overview]
Message-ID: <202005160522.pbziV3Eg%lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 7837 bytes --]
CC: kbuild-all(a)lists.01.org
In-Reply-To: <1589410909-38925-4-git-send-email-jacob.jun.pan@linux.intel.com>
References: <1589410909-38925-4-git-send-email-jacob.jun.pan@linux.intel.com>
TO: Jacob Pan <jacob.jun.pan@linux.intel.com>
Hi Jacob,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.7-rc5 next-20200515]
[cannot apply to iommu/next linux/master]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Jacob-Pan/Nested-Shared-Virtual-Address-SVA-VT-d-support/20200514-070150
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 24085f70a6e1b0cb647ec92623284641d8270637
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-193-gb8fad4bc-dirty
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/iommu/intel-pasid.c:743:33: sparse: sparse: non size-preserving pointer to integer cast
drivers/iommu/intel-pasid.c:744:17: sparse: sparse: non size-preserving pointer to integer cast
drivers/iommu/intel-pasid.c:749:35: sparse: sparse: non size-preserving pointer to integer cast
# https://github.com/0day-ci/linux/commit/f7bb13d830a2527772eceb1fcb7d76a82e20ae72
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout f7bb13d830a2527772eceb1fcb7d76a82e20ae72
vim +743 drivers/iommu/intel-pasid.c
f7bb13d830a252 Jacob Pan 2020-05-13 664
f7bb13d830a252 Jacob Pan 2020-05-13 665 /**
f7bb13d830a252 Jacob Pan 2020-05-13 666 * intel_pasid_setup_nested() - Set up PASID entry for nested translation.
f7bb13d830a252 Jacob Pan 2020-05-13 667 * This could be used for guest shared virtual address. In this case, the
f7bb13d830a252 Jacob Pan 2020-05-13 668 * first level page tables are used for GVA-GPA translation in the guest,
f7bb13d830a252 Jacob Pan 2020-05-13 669 * second level page tables are used for GPA-HPA translation.
f7bb13d830a252 Jacob Pan 2020-05-13 670 *
f7bb13d830a252 Jacob Pan 2020-05-13 671 * @iommu: IOMMU which the device belong to
f7bb13d830a252 Jacob Pan 2020-05-13 672 * @dev: Device to be set up for translation
f7bb13d830a252 Jacob Pan 2020-05-13 673 * @gpgd: FLPTPTR: First Level Page translation pointer in GPA
f7bb13d830a252 Jacob Pan 2020-05-13 674 * @pasid: PASID to be programmed in the device PASID table
f7bb13d830a252 Jacob Pan 2020-05-13 675 * @pasid_data: Additional PASID info from the guest bind request
f7bb13d830a252 Jacob Pan 2020-05-13 676 * @domain: Domain info for setting up second level page tables
f7bb13d830a252 Jacob Pan 2020-05-13 677 * @addr_width: Address width of the first level (guest)
f7bb13d830a252 Jacob Pan 2020-05-13 678 */
f7bb13d830a252 Jacob Pan 2020-05-13 679 int intel_pasid_setup_nested(struct intel_iommu *iommu, struct device *dev,
f7bb13d830a252 Jacob Pan 2020-05-13 680 pgd_t *gpgd, int pasid,
f7bb13d830a252 Jacob Pan 2020-05-13 681 struct iommu_gpasid_bind_data_vtd *pasid_data,
f7bb13d830a252 Jacob Pan 2020-05-13 682 struct dmar_domain *domain, int addr_width)
f7bb13d830a252 Jacob Pan 2020-05-13 683 {
f7bb13d830a252 Jacob Pan 2020-05-13 684 struct pasid_entry *pte;
f7bb13d830a252 Jacob Pan 2020-05-13 685 struct dma_pte *pgd;
f7bb13d830a252 Jacob Pan 2020-05-13 686 int ret = 0;
f7bb13d830a252 Jacob Pan 2020-05-13 687 u64 pgd_val;
f7bb13d830a252 Jacob Pan 2020-05-13 688 int agaw;
f7bb13d830a252 Jacob Pan 2020-05-13 689 u16 did;
f7bb13d830a252 Jacob Pan 2020-05-13 690
f7bb13d830a252 Jacob Pan 2020-05-13 691 if (!ecap_nest(iommu->ecap)) {
f7bb13d830a252 Jacob Pan 2020-05-13 692 pr_err_ratelimited("IOMMU: %s: No nested translation support\n",
f7bb13d830a252 Jacob Pan 2020-05-13 693 iommu->name);
f7bb13d830a252 Jacob Pan 2020-05-13 694 return -EINVAL;
f7bb13d830a252 Jacob Pan 2020-05-13 695 }
f7bb13d830a252 Jacob Pan 2020-05-13 696
f7bb13d830a252 Jacob Pan 2020-05-13 697 if (!(domain->flags & DOMAIN_FLAG_NESTING_MODE)) {
f7bb13d830a252 Jacob Pan 2020-05-13 698 pr_err_ratelimited("Domain is not in nesting mode, %x\n",
f7bb13d830a252 Jacob Pan 2020-05-13 699 domain->flags);
f7bb13d830a252 Jacob Pan 2020-05-13 700 return -EINVAL;
f7bb13d830a252 Jacob Pan 2020-05-13 701 }
f7bb13d830a252 Jacob Pan 2020-05-13 702
f7bb13d830a252 Jacob Pan 2020-05-13 703 pte = intel_pasid_get_entry(dev, pasid);
f7bb13d830a252 Jacob Pan 2020-05-13 704 if (WARN_ON(!pte))
f7bb13d830a252 Jacob Pan 2020-05-13 705 return -EINVAL;
f7bb13d830a252 Jacob Pan 2020-05-13 706
f7bb13d830a252 Jacob Pan 2020-05-13 707 /*
f7bb13d830a252 Jacob Pan 2020-05-13 708 * Caller must ensure PASID entry is not in use, i.e. not bind the
f7bb13d830a252 Jacob Pan 2020-05-13 709 * same PASID to the same device twice.
f7bb13d830a252 Jacob Pan 2020-05-13 710 */
f7bb13d830a252 Jacob Pan 2020-05-13 711 if (pasid_pte_is_present(pte))
f7bb13d830a252 Jacob Pan 2020-05-13 712 return -EBUSY;
f7bb13d830a252 Jacob Pan 2020-05-13 713
f7bb13d830a252 Jacob Pan 2020-05-13 714 pasid_clear_entry(pte);
f7bb13d830a252 Jacob Pan 2020-05-13 715
f7bb13d830a252 Jacob Pan 2020-05-13 716 /* Sanity checking performed by caller to make sure address
f7bb13d830a252 Jacob Pan 2020-05-13 717 * width matching in two dimensions:
f7bb13d830a252 Jacob Pan 2020-05-13 718 * 1. CPU vs. IOMMU
f7bb13d830a252 Jacob Pan 2020-05-13 719 * 2. Guest vs. Host.
f7bb13d830a252 Jacob Pan 2020-05-13 720 */
f7bb13d830a252 Jacob Pan 2020-05-13 721 switch (addr_width) {
f7bb13d830a252 Jacob Pan 2020-05-13 722 #ifdef CONFIG_X86
f7bb13d830a252 Jacob Pan 2020-05-13 723 case ADDR_WIDTH_5LEVEL:
f7bb13d830a252 Jacob Pan 2020-05-13 724 if (cpu_feature_enabled(X86_FEATURE_LA57) &&
f7bb13d830a252 Jacob Pan 2020-05-13 725 cap_5lp_support(iommu->cap)) {
f7bb13d830a252 Jacob Pan 2020-05-13 726 pasid_set_flpm(pte, 1);
f7bb13d830a252 Jacob Pan 2020-05-13 727 } else {
f7bb13d830a252 Jacob Pan 2020-05-13 728 dev_err_ratelimited(dev, "5-level paging not supported\n");
f7bb13d830a252 Jacob Pan 2020-05-13 729 return -EINVAL;
f7bb13d830a252 Jacob Pan 2020-05-13 730 }
f7bb13d830a252 Jacob Pan 2020-05-13 731 break;
f7bb13d830a252 Jacob Pan 2020-05-13 732 #endif
f7bb13d830a252 Jacob Pan 2020-05-13 733 case ADDR_WIDTH_4LEVEL:
f7bb13d830a252 Jacob Pan 2020-05-13 734 pasid_set_flpm(pte, 0);
f7bb13d830a252 Jacob Pan 2020-05-13 735 break;
f7bb13d830a252 Jacob Pan 2020-05-13 736 default:
f7bb13d830a252 Jacob Pan 2020-05-13 737 dev_err_ratelimited(dev, "Invalid guest address width %d\n",
f7bb13d830a252 Jacob Pan 2020-05-13 738 addr_width);
f7bb13d830a252 Jacob Pan 2020-05-13 739 return -EINVAL;
f7bb13d830a252 Jacob Pan 2020-05-13 740 }
f7bb13d830a252 Jacob Pan 2020-05-13 741
f7bb13d830a252 Jacob Pan 2020-05-13 742 /* First level PGD is in GPA, must be supported by the second level */
f7bb13d830a252 Jacob Pan 2020-05-13 @743 if ((unsigned long long)gpgd > domain->max_addr) {
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
next reply other threads:[~2020-05-15 21:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-15 21:11 kbuild test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-05-13 23:01 [PATCH v13 0/8] Nested Shared Virtual Address (SVA) VT-d support Jacob Pan
2020-05-13 23:01 ` [PATCH v13 3/8] iommu/vt-d: Add nested translation helper function Jacob Pan
2020-05-13 23:01 ` Jacob Pan
2020-05-14 5:54 ` Christoph Hellwig
2020-05-14 5:54 ` Christoph Hellwig
2020-05-14 15:31 ` Jacob Pan
2020-05-14 15:31 ` Jacob Pan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202005160522.pbziV3Eg%lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.