qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] f85504: net: Add SunGEM device emulation as f


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] f85504: net: Add SunGEM device emulation as found on Apple...
Date: Fri, 15 Sep 2017 12:28:38 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: f85504b23a59f769f36f7c4d4e0ce8fd08c78749
      
https://github.com/qemu/qemu/commit/f85504b23a59f769f36f7c4d4e0ce8fd08c78749
  Author: Benjamin Herrenschmidt <address@hidden>
  Date:   2017-09-15 (Fri, 15 Sep 2017)

  Changed paths:
    M default-configs/ppc-softmmu.mak
    M hw/net/Makefile.objs
    A hw/net/sungem.c
    M hw/net/trace-events
    M hw/pci/pci.c
    M include/hw/pci/pci_ids.h

  Log Message:
  -----------
  net: Add SunGEM device emulation as found on Apple UniNorth

This adds a simplistic emulation of the Sun GEM ethernet controller
found in Apple ASICs.

Currently we only support the Apple UniNorth 1.x variant, but the
other Apple or Sun variants should mostly be a matter of adding
PCI IDs options.

We have a very primitive emulation of a single Broadcom 5201 PHY
which is supported by the MacOS driver.

This model brings out-of-the-box networking to MacOS 9, and all
versions of OS X I tried with the mac99 platform.

Further improvements from Mark:
- Remove sungem.h file, moving constants into sungem.c as required
- Switch to using tracepoints for debugging
- Split register blocks into separate memory regions
- Use arrays in SunGEMState to hold register values
- Add state-saving support

Signed-off-by: Benjamin Herrenschmidt <address@hidden>
Signed-off-by: Mark Cave-Ayland <address@hidden>
Signed-off-by: David Gibson <address@hidden>


  Commit: c86c1affaec4bfa82eac226965e4be21fc44d538
      
https://github.com/qemu/qemu/commit/c86c1affaec4bfa82eac226965e4be21fc44d538
  Author: Daniel Henrique Barboza <address@hidden>
  Date:   2017-09-15 (Fri, 15 Sep 2017)

  Changed paths:
    M hw/ppc/spapr.c

  Log Message:
  -----------
  hw/ppc/spapr.c: cleaning up qdev_get_machine() calls

This patch removes the qdev_get_machine() calls that are made in
spapr.c in situations where we can get an existing pointer for
the MachineState by either passing it as an argument to the function
or by using other already available pointers.

The following changes were made:

- spapr_node0_size: static function that is called two times:
at spapr_setup_hpt_and_vrma and ppc_spapr_init. In both cases we can
pass an existing MachineState pointer to it.

- spapr_build_fdt: MachineState pointer can be retrieved from
the existing sPAPRMachineState pointer.

- spapr_boot_set: the opaque in the first arg is a sPAPRMachineState
pointer as we can see inside ppc_spapr_init:

    qemu_register_boot_set(spapr_boot_set, spapr);

We can get a MachineState pointer from it.

- spapr_machine_device_plug and spapr_machine_device_unplug_request: the
MachineState, sPAPRMachineState, MachineClass and sPAPRMachineClass pointers
can all be retrieved from the HotplugHandler pointer.

Signed-off-by: Daniel Henrique Barboza <address@hidden>
Reviewed-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>


  Commit: 8f68760561abf90156456fec6ad55c3b2a066d46
      
https://github.com/qemu/qemu/commit/8f68760561abf90156456fec6ad55c3b2a066d46
  Author: Greg Kurz <address@hidden>
  Date:   2017-09-15 (Fri, 15 Sep 2017)

  Changed paths:
    M hw/ppc/spapr_pci.c

  Log Message:
  -----------
  spapr_pci: drop useless check in spapr_phb_vfio_get_loc_code()

g_strdup_printf() either returns a non-null pointer, or aborts if it
failed to allocate memory.

Signed-off-by: Greg Kurz <address@hidden>
[dwg: Grammatical fix to commit message]
Acked-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: David Gibson <address@hidden>


  Commit: d049bde69d8ab3dfa4edeee48896088ae9feb693
      
https://github.com/qemu/qemu/commit/d049bde69d8ab3dfa4edeee48896088ae9feb693
  Author: Greg Kurz <address@hidden>
  Date:   2017-09-15 (Fri, 15 Sep 2017)

  Changed paths:
    M hw/ppc/spapr_pci.c

  Log Message:
  -----------
  spapr_pci: drop useless check in spapr_populate_pci_child_dt()

spapr_phb_get_loc_code() either returns a non-null pointer, or aborts
if g_strdup_printf() failed to allocate memory.

Signed-off-by: Greg Kurz <address@hidden>
[dwg: Grammatical fix to commit message]
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: David Gibson <address@hidden>


  Commit: 549ce59e2b9ed7f41d2f88524bd5e01b0d7db2e9
      
https://github.com/qemu/qemu/commit/549ce59e2b9ed7f41d2f88524bd5e01b0d7db2e9
  Author: Greg Kurz <address@hidden>
  Date:   2017-09-15 (Fri, 15 Sep 2017)

  Changed paths:
    M hw/ppc/spapr_pci.c

  Log Message:
  -----------
  spapr_pci: use g_strdup_printf()

Building strings with g_strdup_printf() instead of snprintf() is
a QEMU common practice.

Signed-off-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>


  Commit: 4c563d9df556454e6278035927e9e082a05b30af
      
https://github.com/qemu/qemu/commit/4c563d9df556454e6278035927e9e082a05b30af
  Author: Greg Kurz <address@hidden>
  Date:   2017-09-15 (Fri, 15 Sep 2017)

  Changed paths:
    M hw/ppc/spapr_hcall.c

  Log Message:
  -----------
  spapr: only update SDR1 once per-cpu during CAS

Commit b55d295e3ec9 added the possibility to support HPT resizing with KVM.
In the case of PR, we need to pass the userspace address of the HPT to KVM
using the SDR1 slot.
This is handled by kvmppc_update_sdr1() which uses CPU_FOREACH() to update
all CPUs. It is hence not needed to call kvmppc_update_sdr1() for each CPU.

Signed-off-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>


  Commit: 21f3f8db0e61884ca48e9969b0305d54f1efe24b
      
https://github.com/qemu/qemu/commit/21f3f8db0e61884ca48e9969b0305d54f1efe24b
  Author: Cédric Le Goater <address@hidden>
  Date:   2017-09-15 (Fri, 15 Sep 2017)

  Changed paths:
    M hw/ppc/spapr.c
    M include/hw/ppc/spapr_ovec.h

  Log Message:
  -----------
  ppc/xive: fix OV5_XIVE_EXPLOIT bits

On POWER9, the Client Architecture Support (CAS) negotiation process
determines whether the guest operates in XIVE Legacy compatibility or
in XIVE exploitation mode. Now that we have initial guest support for
the XIVE interrupt controller, let's fix the bits definition which have
evolved in the latest specs.

The platform advertises the XIVE Exploitation Mode support using the
property "ibm,arch-vec-5-platform-support-vec-5", byte 23 bits 0-1 :

 - 0b00 XIVE legacy mode Only
 - 0b01 XIVE exploitation mode Only
 - 0b10 XIVE legacy or exploitation mode

The OS asks for XIVE Exploitation Mode support using the property
"ibm,architecture-vec-5", byte 23 bits 0-1:

 - 0b00 XIVE legacy mode Only
 - 0b01 XIVE exploitation mode Only

Signed-off-by: Cédric Le Goater <address@hidden>
Signed-off-by: David Gibson <address@hidden>


  Commit: 30bf9ed1684da582e47ae004f8f3cf14fd6f39dd
      
https://github.com/qemu/qemu/commit/30bf9ed1684da582e47ae004f8f3cf14fd6f39dd
  Author: Cédric Le Goater <address@hidden>
  Date:   2017-09-15 (Fri, 15 Sep 2017)

  Changed paths:
    M hw/ppc/spapr_hcall.c

  Log Message:
  -----------
  spapr: fix CAS-generated reset

The OV5_MMU_RADIX_300 requires special handling in the CAS negotiation
process. It is cleared from the option vector of the guest before
evaluating the changes and re-added later. But, when testing for a
possible CAS reset :

    spapr->cas_reboot = spapr_ovec_diff(ov5_updates,
                                  ov5_cas_old, spapr->ov5_cas);

the bit OV5_MMU_RADIX_300 will each time be seen as removed from the
previous OV5 set, hence generating a reset loop.

Fix this problem by also clearing the same bit in the ov5_cas_old set.

Signed-off-by: Cédric Le Goater <address@hidden>
Signed-off-by: David Gibson <address@hidden>


  Commit: 99372e785efe9fe6a4e30cab4e33b79b227dc28d
      
https://github.com/qemu/qemu/commit/99372e785efe9fe6a4e30cab4e33b79b227dc28d
  Author: Greg Kurz <address@hidden>
  Date:   2017-09-15 (Fri, 15 Sep 2017)

  Changed paths:
    M hw/ppc/spapr_pci.c

  Log Message:
  -----------
  spapr_pci: use the common _FDT() helper

All other users in hw/ppc already consider an error when building
the FDT to be fatal, even on hotplug paths. There's no valid reason
for spapr_pci to behave differently. So let's used the common _FDT()
helper which terminates QEMU when libfdt fails.

Signed-off-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>


  Commit: 9ba255365e19db6cce8ad6d03bc02db96c429641
      
https://github.com/qemu/qemu/commit/9ba255365e19db6cce8ad6d03bc02db96c429641
  Author: Greg Kurz <address@hidden>
  Date:   2017-09-15 (Fri, 15 Sep 2017)

  Changed paths:
    M hw/ppc/spapr_pci.c

  Log Message:
  -----------
  spapr_pci: handle FDT creation errors with _FDT()

libfdt failures when creating the FDT should cause QEMU to terminate.

Let's use the _FDT() macro which does just that instead of propagating
the error to the caller. spapr_populate_pci_child_dt() no longer needs
to return a value in this case.

Note that, on the way, this get rids of the following nonsensical lines:

    g_assert(!ret);
    if (ret) {

Signed-off-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>


  Commit: e100161b69f8cf56dae866912dfffe7dcd7140af
      
https://github.com/qemu/qemu/commit/e100161b69f8cf56dae866912dfffe7dcd7140af
  Author: Alexey Kardashevskiy <address@hidden>
  Date:   2017-09-15 (Fri, 15 Sep 2017)

  Changed paths:
    M hw/vfio/spapr.c

  Log Message:
  -----------
  vfio, spapr: Fix levels calculation

The existing tries to round up the number of pages but @pages is always
calculated as the rounded up value minus one  which makes ctz64() always
return 0 and have create.levels always set 1.

This removes wrong "-1" and allows having more than 1 levels. This becomes
handy for >128GB guests with standard 64K pages as this requires blocks
with zone order 9 and the popular limit of CONFIG_FORCE_MAX_ZONEORDER=9
means that only blocks up to order 8 are allowed.

Signed-off-by: Alexey Kardashevskiy <address@hidden>
Signed-off-by: David Gibson <address@hidden>


  Commit: a1a6bbde4f6a29368f8f605cea2e73630ec1bc7c
      
https://github.com/qemu/qemu/commit/a1a6bbde4f6a29368f8f605cea2e73630ec1bc7c
  Author: Greg Kurz <address@hidden>
  Date:   2017-09-15 (Fri, 15 Sep 2017)

  Changed paths:
    M hw/intc/xics.c

  Log Message:
  -----------
  xics: fix several error leaks

If object_property_get_link() fails then it allocates an error, which
must be freed before returning. The error_get_pretty() function is
merely an accessor to the error message and doesn't free anything.

The error.h header indicates how to do it right:

 * Pass an existing error to the caller with the message modified:
 *     error_propagate(errp, err);
 *     error_prepend(errp, "Could not frobnicate '%s': ", name);

Signed-off-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>


  Commit: 1bbadc759e23ef8629ef955a4b78f06da2e5a381
      
https://github.com/qemu/qemu/commit/1bbadc759e23ef8629ef955a4b78f06da2e5a381
  Author: Greg Kurz <address@hidden>
  Date:   2017-09-15 (Fri, 15 Sep 2017)

  Changed paths:
    M hw/ppc/spapr_cpu_core.c

  Log Message:
  -----------
  spapr_cpu_core: fail gracefully with non-pseries machine types

Since commit 7cca3e466eb0 ("ppc: spapr: Move VCPU ID calculation into
sPAPR"), QEMU aborts when started with a *-spapr-cpu-core device and
a non-pseries machine.

Let's rely on the already existing call to object_dynamic_cast() instead
of using the SPAPR_MACHINE() macro.

Signed-off-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>


  Commit: 1d36da769a4e390a63db1d44114741bb924acdd6
      
https://github.com/qemu/qemu/commit/1d36da769a4e390a63db1d44114741bb924acdd6
  Author: Greg Kurz <address@hidden>
  Date:   2017-09-15 (Fri, 15 Sep 2017)

  Changed paths:
    M hw/ppc/spapr_pci.c

  Log Message:
  -----------
  spapr_pci: convert sprintf() to g_strdup_printf()

In order to follow a QEMU common practice.

Signed-off-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>


  Commit: 96dbc9af35eb6672a3b531da8bba521ce46c26dc
      
https://github.com/qemu/qemu/commit/96dbc9af35eb6672a3b531da8bba521ce46c26dc
  Author: Greg Kurz <address@hidden>
  Date:   2017-09-15 (Fri, 15 Sep 2017)

  Changed paths:
    M hw/ppc/spapr_pci.c

  Log Message:
  -----------
  spapr_pci: don't create 64-bit MMIO window if we don't need to

When running a pseries-2.2 or older machine type, we get the following
lines in info mtree:

address-space: memory
...
ffffffffffffffff-ffffffffffffffff (prio 0, i/o): alias
 address@hidden @address@hidden
  ffffffffffffffff-ffffffffffffffff

address-space: cpu-memory
...
ffffffffffffffff-ffffffffffffffff (prio 0, i/o): alias
 address@hidden @address@hidden
  ffffffffffffffff-ffffffffffffffff

The same thing occurs when running a pseries-2.7 with

    -global spapr-pci-host-bridge.mem_win_size=2147483648

This happens because we always create a 64-bit MMIO window, even if
we didn't explicitely requested it (ie, mem64_win_size == 0) and the
32-bit window is below 2GiB. It doesn't seem to have an impact on the
guest though because spapr_populate_pci_dt() doesn't advertise the
bogus windows when mem64_win_size == 0.

Since these memory regions don't induce any state, we can safely
choose to not create them when their address is equal to -1,
without breaking migration from existing setups.

Signed-off-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>


  Commit: 3b2fcedd52986db92fd17127c73d9c09d4ae2da1
      
https://github.com/qemu/qemu/commit/3b2fcedd52986db92fd17127c73d9c09d4ae2da1
  Author: Greg Kurz <address@hidden>
  Date:   2017-09-15 (Fri, 15 Sep 2017)

  Changed paths:
    M hw/ppc/spapr_cpu_core.c

  Log Message:
  -----------
  spapr_cpu_core: cleaning up qdev_get_machine() calls

This patch removes the qdev_get_machine() calls that are made
in spapr_cpu_core.c in situations where we can get an existing
pointer for the MachineState by either passing it as an argument
to the function or by using other already available pointers.

Credits to Daniel Henrique Barboza for the idea and the changelog
text.

Signed-off-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>


  Commit: d492a75cfefd9a09125ba2b007c817c1417c3820
      
https://github.com/qemu/qemu/commit/d492a75cfefd9a09125ba2b007c817c1417c3820
  Author: Greg Kurz <address@hidden>
  Date:   2017-09-15 (Fri, 15 Sep 2017)

  Changed paths:
    M hw/ppc/spapr_events.c

  Log Message:
  -----------
  spapr_events: use QTAILQ_FOREACH_SAFE() in spapr_clear_pending_events()

QTAILQ_FOREACH_SAFE() must be used when removing the current element
inside the loop block.

This fixes a user-after-free error introduced by commit 56258174238eb
and reported by Coverity (CID 1381017).

Signed-off-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>


  Commit: 70a0c19e83aa4c71c879d51e426e89e4b3d4e014
      
https://github.com/qemu/qemu/commit/70a0c19e83aa4c71c879d51e426e89e4b3d4e014
  Author: Greg Kurz <address@hidden>
  Date:   2017-09-15 (Fri, 15 Sep 2017)

  Changed paths:
    M target/ppc/kvm.c

  Log Message:
  -----------
  ppc/kvm: use kvm_vm_check_extension() in kvmppc_is_pr()

If the host has both KVM PR and KVM HV loaded and we pass:

        -machine pseries,accel=kvm,kvm-type=PR

the kvmppc_is_pr() returns false instead of true. Since the helper
is mostly used as fallback, it doesn't have any real impact with
recent kernels. A notable exception is the workaround to allow
migration between compatible hosts with different PVRs (eg, POWER8
and POWER8E), since KVM still doesn't provide a way to check if a
specific PVR is supported (see commit c363a37a450f for details).

According to the official KVM API documentation [1], KVM_PPC_GET_PVINFO
is "vm ioctl", but we check it as a global ioctl. The following function
in KVM is hence called with kvm == NULL and considers we're in HV mode.

int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
{
        int r;
        /* Assume we're using HV mode when the HV module is loaded */
        int hv_enabled = kvmppc_hv_ops ? 1 : 0;

        if (kvm) {
                /*
                 * Hooray - we know which VM type we're running on. Depend on
                 * that rather than the guess above.
                 */
                hv_enabled = is_kvmppc_hv_enabled(kvm);
        }

Let's use kvm_vm_check_extension() to fix the issue.

[1] https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt

Signed-off-by: Greg Kurz <address@hidden>
Reviewed-by: Thomas Huth <address@hidden>
Signed-off-by: David Gibson <address@hidden>


  Commit: d535f5d363e29ad6f07e2df4c1ef1d3f17222198
      
https://github.com/qemu/qemu/commit/d535f5d363e29ad6f07e2df4c1ef1d3f17222198
  Author: Peter Maydell <address@hidden>
  Date:   2017-09-15 (Fri, 15 Sep 2017)

  Changed paths:
    M default-configs/ppc-softmmu.mak
    M hw/intc/xics.c
    M hw/net/Makefile.objs
    A hw/net/sungem.c
    M hw/net/trace-events
    M hw/pci/pci.c
    M hw/ppc/spapr.c
    M hw/ppc/spapr_cpu_core.c
    M hw/ppc/spapr_events.c
    M hw/ppc/spapr_hcall.c
    M hw/ppc/spapr_pci.c
    M hw/vfio/spapr.c
    M include/hw/pci/pci_ids.h
    M include/hw/ppc/spapr_ovec.h
    M target/ppc/kvm.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.11-20170915' 
into staging

ppc patch queue 2017-09-15

Here's the current batch of accumulated ppc patches.  These are all
pretty simple bugfixes or cleanups, no big new features here.

# gpg: Signature made Fri 15 Sep 2017 04:50:00 BST
# gpg:                using RSA key 0x6C38CACA20D9B392
# gpg: Good signature from "David Gibson <address@hidden>"
# gpg:                 aka "David Gibson (Red Hat) <address@hidden>"
# gpg:                 aka "David Gibson (ozlabs.org) <address@hidden>"
# gpg:                 aka "David Gibson (kernel.org) <address@hidden>"
# Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392

* remotes/dgibson/tags/ppc-for-2.11-20170915:
  ppc/kvm: use kvm_vm_check_extension() in kvmppc_is_pr()
  spapr_events: use QTAILQ_FOREACH_SAFE() in spapr_clear_pending_events()
  spapr_cpu_core: cleaning up qdev_get_machine() calls
  spapr_pci: don't create 64-bit MMIO window if we don't need to
  spapr_pci: convert sprintf() to g_strdup_printf()
  spapr_cpu_core: fail gracefully with non-pseries machine types
  xics: fix several error leaks
  vfio, spapr: Fix levels calculation
  spapr_pci: handle FDT creation errors with _FDT()
  spapr_pci: use the common _FDT() helper
  spapr: fix CAS-generated reset
  ppc/xive: fix OV5_XIVE_EXPLOIT bits
  spapr: only update SDR1 once per-cpu during CAS
  spapr_pci: use g_strdup_printf()
  spapr_pci: drop useless check in spapr_populate_pci_child_dt()
  spapr_pci: drop useless check in spapr_phb_vfio_get_loc_code()
  hw/ppc/spapr.c: cleaning up qdev_get_machine() calls
  net: Add SunGEM device emulation as found on Apple UniNorth

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/d28e29a92585...d535f5d363e2

reply via email to

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