[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 62/64] spapr: implement H_CHANGE_LOGICAL_LAN_MAC h_ca
From: |
David Gibson |
Subject: |
[Qemu-devel] [PULL 62/64] spapr: implement H_CHANGE_LOGICAL_LAN_MAC h_call |
Date: |
Wed, 7 Sep 2016 20:29:41 +1000 |
From: Laurent Vivier <address@hidden>
Since kernel v4.0, linux uses H_CHANGE_LOGICAL_LAN_MAC to change lively
the MAC address of an ibmveth interface.
As QEMU doesn't implement this h_call, we can't change anymore the
MAC address of an spapr-vlan interface.
Signed-off-by: Laurent Vivier <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/net/spapr_llan.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c
index b273eda..4bb95a5 100644
--- a/hw/net/spapr_llan.c
+++ b/hw/net/spapr_llan.c
@@ -106,6 +106,7 @@ typedef struct VIOsPAPRVLANDevice {
VIOsPAPRDevice sdev;
NICConf nicconf;
NICState *nic;
+ MACAddr perm_mac;
bool isopen;
hwaddr buf_list;
uint32_t add_buf_ptr, use_buf_ptr, rx_bufs;
@@ -316,6 +317,10 @@ static void spapr_vlan_reset(VIOsPAPRDevice *sdev)
spapr_vlan_reset_rx_pool(dev->rx_pool[i]);
}
}
+
+ memcpy(&dev->nicconf.macaddr.a, &dev->perm_mac.a,
+ sizeof(dev->nicconf.macaddr.a));
+ qemu_format_nic_info_str(qemu_get_queue(dev->nic), dev->nicconf.macaddr.a);
}
static void spapr_vlan_realize(VIOsPAPRDevice *sdev, Error **errp)
@@ -324,6 +329,8 @@ static void spapr_vlan_realize(VIOsPAPRDevice *sdev, Error
**errp)
qemu_macaddr_default_if_unset(&dev->nicconf.macaddr);
+ memcpy(&dev->perm_mac.a, &dev->nicconf.macaddr.a, sizeof(dev->perm_mac.a));
+
dev->nic = qemu_new_nic(&net_spapr_vlan_info, &dev->nicconf,
object_get_typename(OBJECT(sdev)), sdev->qdev.id,
dev);
qemu_format_nic_info_str(qemu_get_queue(dev->nic), dev->nicconf.macaddr.a);
@@ -756,6 +763,27 @@ static target_ulong h_multicast_ctrl(PowerPCCPU *cpu,
sPAPRMachineState *spapr,
return H_SUCCESS;
}
+static target_ulong h_change_logical_lan_mac(PowerPCCPU *cpu,
+ sPAPRMachineState *spapr,
+ target_ulong opcode,
+ target_ulong *args)
+{
+ target_ulong reg = args[0];
+ target_ulong macaddr = args[1];
+ VIOsPAPRDevice *sdev = spapr_vio_find_by_reg(spapr->vio_bus, reg);
+ VIOsPAPRVLANDevice *dev = VIO_SPAPR_VLAN_DEVICE(sdev);
+ int i;
+
+ for (i = 0; i < ETH_ALEN; i++) {
+ dev->nicconf.macaddr.a[ETH_ALEN - i - 1] = macaddr & 0xff;
+ macaddr >>= 8;
+ }
+
+ qemu_format_nic_info_str(qemu_get_queue(dev->nic), dev->nicconf.macaddr.a);
+
+ return H_SUCCESS;
+}
+
static Property spapr_vlan_properties[] = {
DEFINE_SPAPR_PROPERTIES(VIOsPAPRVLANDevice, sdev),
DEFINE_NIC_PROPERTIES(VIOsPAPRVLANDevice, nicconf),
@@ -854,6 +882,8 @@ static void spapr_vlan_register_types(void)
spapr_register_hypercall(H_ADD_LOGICAL_LAN_BUFFER,
h_add_logical_lan_buffer);
spapr_register_hypercall(H_MULTICAST_CTRL, h_multicast_ctrl);
+ spapr_register_hypercall(H_CHANGE_LOGICAL_LAN_MAC,
+ h_change_logical_lan_mac);
type_register_static(&spapr_vlan_info);
}
--
2.7.4
- [Qemu-devel] [PULL 39/64] ppc: Speed up dcbz, (continued)
- [Qemu-devel] [PULL 39/64] ppc: Speed up dcbz, David Gibson, 2016/09/07
- [Qemu-devel] [PULL 40/64] ppc: Fix CFAR updates, David Gibson, 2016/09/07
- [Qemu-devel] [PULL 55/64] ppc: Fix macio ESCC legacy mapping, David Gibson, 2016/09/07
- [Qemu-devel] [PULL 46/64] target-ppc: add dtstsfi[q] instructions, David Gibson, 2016/09/07
- [Qemu-devel] [PULL 22/64] ppc: Rename fload_invalid_op_excp to float_invalid_op_excp, David Gibson, 2016/09/07
- [Qemu-devel] [PULL 36/64] ppc: Don't update NIP in dcbz and lscbx, David Gibson, 2016/09/07
- [Qemu-devel] [PULL 61/64] ppc: Improve a few more helper flags, David Gibson, 2016/09/07
- [Qemu-devel] [PULL 58/64] ppc: Don't generate dead code on unconditional branches, David Gibson, 2016/09/07
- [Qemu-devel] [PULL 59/64] ppc: Improve flags for helpers loading/writing the time facilities, David Gibson, 2016/09/07
- [Qemu-devel] [PULL 52/64] ppc: Rename #include'd .c files to .inc.c, David Gibson, 2016/09/07
- [Qemu-devel] [PULL 62/64] spapr: implement H_CHANGE_LOGICAL_LAN_MAC h_call,
David Gibson <=
- [Qemu-devel] [PULL 56/64] ppc: Fix catching some segfaults in user mode, David Gibson, 2016/09/07
- [Qemu-devel] [PULL 57/64] ppc: Stop dumping state on all exceptions in linux-user, David Gibson, 2016/09/07
- [Qemu-devel] [PULL 63/64] tests: Resort check-qtest entries in Makefile.include, David Gibson, 2016/09/07
- [Qemu-devel] [PULL 64/64] tests: Check serial output of firmware boot of some machines, David Gibson, 2016/09/07
- [Qemu-devel] [PULL 45/64] target-ppc: implement branch-less divd[o][.], David Gibson, 2016/09/07
- [Qemu-devel] [PULL 21/64] ppc: Move VSX ops out of translate.c, David Gibson, 2016/09/07
- [Qemu-devel] [PULL 17/64] ppc: Move classic fp ops out of translate.c, David Gibson, 2016/09/07
- [Qemu-devel] [PULL 20/64] ppc: Move VMX ops out of translate.c, David Gibson, 2016/09/07
- [Qemu-devel] [PULL 18/64] ppc: Move embedded spe ops out of translate.c, David Gibson, 2016/09/07
- Re: [Qemu-devel] [PULL 00/64] ppc-for-2.8 queue 20160907, no-reply, 2016/09/07