qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] a9321a: x86: Implement SMEP and SMAP


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] a9321a: x86: Implement SMEP and SMAP
Date: Mon, 01 Oct 2012 09:30:09 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: a9321a4d49d65d29c2926a51aedc5b91a01f3591
      
https://github.com/qemu/qemu/commit/a9321a4d49d65d29c2926a51aedc5b91a01f3591
  Author: H. Peter Anvin <address@hidden>
  Date:   2012-10-01 (Mon, 01 Oct 2012)

  Changed paths:
    M target-i386/cc_helper.c
    M target-i386/cpu.c
    M target-i386/cpu.h
    M target-i386/helper.c
    M target-i386/helper.h
    M target-i386/translate.c

  Log Message:
  -----------
  x86: Implement SMEP and SMAP

This patch implements Supervisor Mode Execution Prevention (SMEP) and
Supervisor Mode Access Prevention (SMAP) for x86.  The purpose of the
patch, obviously, is to help kernel developers debug the support for
those features.

A fair bit of the code relates to the handling of CPUID features.  The
CPUID code probably would get greatly simplified if all the feature
bit words were unified into a single vector object, but in the
interest of producing a minimal patch for SMEP/SMAP, and because I had
very limited time for this project, I followed the existing style.

[ v2: don't change the definition of the qemu64 CPU shorthand, since
  that breaks loading old snapshots.  Per Anthony Liguori this can be
  fixed once the CPU feature set is snapshot.

  Change the coding style slightly to conform to checkpatch.pl. ]

Signed-off-by: H. Peter Anvin <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: df8c1b0207689a4bcc2396bf5327d5ea135a45bb
      
https://github.com/qemu/qemu/commit/df8c1b0207689a4bcc2396bf5327d5ea135a45bb
  Author: Alex Williamson <address@hidden>
  Date:   2012-10-01 (Mon, 01 Oct 2012)

  Changed paths:
    M scripts/update-linux-headers.sh

  Log Message:
  -----------
  Update kernel header script to include vfio

Signed-off-by: Alex Williamson <address@hidden>
Acked-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: 883f0b85f0cbb8c31baeadfcbfd144a1ed29d935
      
https://github.com/qemu/qemu/commit/883f0b85f0cbb8c31baeadfcbfd144a1ed29d935
  Author: Alex Williamson <address@hidden>
  Date:   2012-10-01 (Mon, 01 Oct 2012)

  Changed paths:
    A linux-headers/linux/vfio.h

  Log Message:
  -----------
  Update Linux kernel headers

Based on Linux as of 1a95620.

Signed-off-by: Alex Williamson <address@hidden>
Acked-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: 65501a745dbaf28284e099f724aa5fc478eae0e7
      
https://github.com/qemu/qemu/commit/65501a745dbaf28284e099f724aa5fc478eae0e7
  Author: Alex Williamson <address@hidden>
  Date:   2012-10-01 (Mon, 01 Oct 2012)

  Changed paths:
    A hw/vfio_pci.c
    A hw/vfio_pci_int.h

  Log Message:
  -----------
  vfio: vfio-pci device assignment driver

This adds the core of the QEMU VFIO-based PCI device assignment driver.
To make use of this driver, enable CONFIG_VFIO, CONFIG_VFIO_IOMMU_TYPE1,
and CONFIG_VFIO_PCI in your host Linux kernel config.  Load the vfio-pci
module.  To assign device 0000:05:00.0 to a guest, do the following:

for dev in $(ls /sys/bus/pci/devices/0000:05:00.0/iommu_group/devices); do
    vendor=$(cat /sys/bus/pci/devices/$dev/vendor)
    device=$(cat /sys/bus/pci/devices/$dev/device)
    if [ -e /sys/bus/pci/devices/$dev/driver ]; then
  echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
    fi
    echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id
done

See Documentation/vfio.txt in the Linux kernel tree for further
description of IOMMU groups and VFIO.

Then launch qemu including the option:

-device vfio-pci,host=0000:05:00.0

Legacy PCI interrupts (INTx) currently makes use of a kludge where we
trap BAR accesses and assume the access is in response to an interrupt,
therefore de-asserting and unmasking the interrupt.  It's not quite as
targetted as using the EOI for this, but it's self contained and seems
to work across all architectures.  The side-effect is a significant
performance slow-down for device in INTx mode.  Some devices, like
graphics cards, don't really use their interrupt, so this can be turned
off with the x-intx=off option, which disables INTx alltogether.  This
should be considered an experimental option until we refine this code.
Both MSI and MSI-X are supported and avoid these issues.

Signed-off-by: Alex Williamson <address@hidden>
Acked-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: 92e1fb5ed1a26d09ee754845d5691d473410c1dc
      
https://github.com/qemu/qemu/commit/92e1fb5ed1a26d09ee754845d5691d473410c1dc
  Author: Alex Williamson <address@hidden>
  Date:   2012-10-01 (Mon, 01 Oct 2012)

  Changed paths:
    M MAINTAINERS
    M hw/Makefile.objs

  Log Message:
  -----------
  vfio: Enable vfio-pci and mark supported

Enabled for all softmmu guests supporting PCI on Linux hosts.  Note
that currently only x86 hosts have the kernel side VFIO IOMMU support
for this.  PPC (g3beige) is the only non-x86 guest known to work.
ARM (veratile) hangs in firmware, others untested.

Signed-off-by: Alex Williamson <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


Compare: https://github.com/qemu/qemu/compare/4a19e505df65...92e1fb5ed1a2

reply via email to

[Prev in Thread] Current Thread [Next in Thread]