[kvmarm:queue 26/31] arch/arm/kvm/../../../virt/kvm/arm/mmu.c:1636:20: error: 'S2_PMD_MASK' undeclared; did you mean 'PMD_MASK'?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: .config.gz
Description: application/gzip

_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux