linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [kvmarm:queue 26/31] arch/arm/kvm/../../../virt/kvm/arm/mmu.c:1636:20: error: 'S2_PMD_MASK' undeclared; did you mean 'PMD_MASK'?
@ 2018-12-19  4:50 kbuild test robot
  0 siblings, 0 replies; only message in thread
From: kbuild test robot @ 2018-12-19  4:50 UTC (permalink / raw)
  To: Christoffer Dall; +Cc: Marc Zyngier, kbuild-all, linux-arm-kernel, kvmarm

[-- Attachment #1: Type: text/plain, Size: 4188 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git queue
head:   0c4011a2150b6d177cdd06c887615594a4693179
commit: 3c780d1840b62d9b5f2abffad6cc1373033ed6ea [26/31] KVM: arm/arm64: Fix unintended stage 2 PMD mappings
config: arm-axm55xx_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 3c780d1840b62d9b5f2abffad6cc1373033ed6ea
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=arm 

All error/warnings (new ones prefixed by >>):

   arch/arm/kvm/../../../virt/kvm/arm/mmu.c: In function 'fault_supports_stage2_pmd_mappings':
>> arch/arm/kvm/../../../virt/kvm/arm/mmu.c:1636:20: error: 'S2_PMD_MASK' undeclared (first use in this function); did you mean 'PMD_MASK'?
     if ((gpa_start & ~S2_PMD_MASK) != (uaddr_start & ~S2_PMD_MASK))
                       ^~~~~~~~~~~
                       PMD_MASK
   arch/arm/kvm/../../../virt/kvm/arm/mmu.c:1636:20: note: each undeclared identifier is reported only once for each function it appears in
>> arch/arm/kvm/../../../virt/kvm/arm/mmu.c:1652:31: error: 'S2_PMD_SIZE' undeclared (first use in this function); did you mean 'PMD_SIZE'?
            (hva & S2_PMD_MASK) + S2_PMD_SIZE <= uaddr_end;
                                  ^~~~~~~~~~~
                                  PMD_SIZE
>> arch/arm/kvm/../../../virt/kvm/arm/mmu.c:1653:1: warning: control reaches end of non-void function [-Wreturn-type]
    }
    ^

vim +1636 arch/arm/kvm/../../../virt/kvm/arm/mmu.c

  1597	
  1598	static bool fault_supports_stage2_pmd_mappings(struct kvm_memory_slot *memslot,
  1599						       unsigned long hva)
  1600	{
  1601		gpa_t gpa_start, gpa_end;
  1602		hva_t uaddr_start, uaddr_end;
  1603		size_t size;
  1604	
  1605		size = memslot->npages * PAGE_SIZE;
  1606	
  1607		gpa_start = memslot->base_gfn << PAGE_SHIFT;
  1608		gpa_end = gpa_start + size;
  1609	
  1610		uaddr_start = memslot->userspace_addr;
  1611		uaddr_end = uaddr_start + size;
  1612	
  1613		/*
  1614		 * Pages belonging to memslots that don't have the same alignment
  1615		 * within a PMD for userspace and IPA cannot be mapped with stage-2
  1616		 * PMD entries, because we'll end up mapping the wrong pages.
  1617		 *
  1618		 * Consider a layout like the following:
  1619		 *
  1620		 *    memslot->userspace_addr:
  1621		 *    +-----+--------------------+--------------------+---+
  1622		 *    |abcde|fgh  Stage-1 PMD    |    Stage-1 PMD   tv|xyz|
  1623		 *    +-----+--------------------+--------------------+---+
  1624		 *
  1625		 *    memslot->base_gfn << PAGE_SIZE:
  1626		 *      +---+--------------------+--------------------+-----+
  1627		 *      |abc|def  Stage-2 PMD    |    Stage-2 PMD     |tvxyz|
  1628		 *      +---+--------------------+--------------------+-----+
  1629		 *
  1630		 * If we create those stage-2 PMDs, we'll end up with this incorrect
  1631		 * mapping:
  1632		 *   d -> f
  1633		 *   e -> g
  1634		 *   f -> h
  1635		 */
> 1636		if ((gpa_start & ~S2_PMD_MASK) != (uaddr_start & ~S2_PMD_MASK))
  1637			return false;
  1638	
  1639		/*
  1640		 * Next, let's make sure we're not trying to map anything not covered
  1641		 * by the memslot. This means we have to prohibit PMD size mappings
  1642		 * for the beginning and end of a non-PMD aligned and non-PMD sized
  1643		 * memory slot (illustrated by the head and tail parts of the
  1644		 * userspace view above containing pages 'abcde' and 'xyz',
  1645		 * respectively).
  1646		 *
  1647		 * Note that it doesn't matter if we do the check using the
  1648		 * userspace_addr or the base_gfn, as both are equally aligned (per
  1649		 * the check above) and equally sized.
  1650		 */
  1651		return (hva & S2_PMD_MASK) >= uaddr_start &&
> 1652		       (hva & S2_PMD_MASK) + S2_PMD_SIZE <= uaddr_end;
> 1653	}
  1654	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 20326 bytes --]

[-- Attachment #3: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-12-19  4:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-19  4:50 [kvmarm:queue 26/31] arch/arm/kvm/../../../virt/kvm/arm/mmu.c:1636:20: error: 'S2_PMD_MASK' undeclared; did you mean 'PMD_MASK'? kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).