On Thu, Mar 20, 2014 at 9:24 PM, Lucas Meneghel Rodrigues
<[email protected]> wrote:
> On 03/20/2014 07:28 AM, Ming Lei wrote:
>>
>> This patch introduces a basic approach to support platform bus.
>> virtio-mmio devices are popular on arm/arm64 VM, so introduce
>> the platform bus for arm/arm64 support.
>>
>> Basically, the patch can start qemu on arm64.
>>
>> Signed-off-by: Ming Lei <[email protected]>
>> ---
>>   shared/cfg/guest-os/Linux/LinuxCustom/trusty.cfg |    1 +
>
>
> ^ The proper way of adding arm trusty to virt-test is by creating the
> following file:
>
> shared/cfg/guest-os/Linux/Ubuntu/14.04-server.arm64.cfg

I will change to this file in v1.

>
> With the contents of the trusty.cfg file. Also, it seems that trusty.cfg has
> a lot of info that belongs to the arch definition rather than the guest os
> definition.
>
> I still need to review the other parts of the patch.
>
>
>>   virttest/qemu_devices/qcontainer.py              |   29
>> +++++++++++++++-------
>>   virttest/qemu_devices/qdevices.py                |   21 ++++++++++++++++
>>   virttest/qemu_vm.py                              |    4 ++-
>>   4 files changed, 45 insertions(+), 10 deletions(-)
>>
>> diff --git a/shared/cfg/guest-os/Linux/LinuxCustom/trusty.cfg
>> b/shared/cfg/guest-os/Linux/LinuxCustom/trusty.cfg
>> index c25851d..b085043 100644
>> --- a/shared/cfg/guest-os/Linux/LinuxCustom/trusty.cfg
>> +++ b/shared/cfg/guest-os/Linux/LinuxCustom/trusty.cfg
>> @@ -11,3 +11,4 @@
>>       pci_assignable = no
>>       usbs = ""
>>       usb_devices = ""
>> +    pci_bus = platform
>
>
> ^ This belongs in fact to the arm variant declaration instead of the guest
> OS declaration.

Could you suggest one place(directory or file) to hold the guest
OS declaration?

>
>
>> diff --git a/virttest/qemu_devices/qcontainer.py
>> b/virttest/qemu_devices/qcontainer.py
>> index 16be016..6edb539 100644
>> --- a/virttest/qemu_devices/qcontainer.py
>> +++ b/virttest/qemu_devices/qcontainer.py
>> @@ -487,6 +487,16 @@ class DevContainer(object):
>>               for device in added_devices:
>>                   self.wash_the_device_out(device)
>>
>> +        def add(device, added_devices):
>> +            if device.get_qid() and self.get_by_qid(device.get_qid()):
>> +                err = "Devices qid %s already used in VM\n" %
>> device.get_qid()
>> +                clean(device, added_devices)
>> +                raise DeviceInsertError(device, err, self)
>> +            device.set_aid(self.__create_unique_aid(device.get_qid()))
>> +            self.__devices.append(device)
>> +            added_devices.append(device)
>> +            return added_devices
>> +
>>           if strict_mode is None:
>>               _strict_mode = self.strict_mode
>>           if strict_mode is True:
>> @@ -498,6 +508,11 @@ class DevContainer(object):
>>                                                               (list,
>> tuple)):
>>               # it have to be list of parent buses
>>               device.parent_bus = (device.parent_bus,)
>> +
>> +        # all platform devices belong to one same platform bus
>> +        if device.is_plat_device():
>> +           return add(device, added_devices)
>> +
>>           for parent_bus in device.parent_bus:
>>               # type, aobject, busid
>>               if parent_bus is None:
>> @@ -540,14 +555,7 @@ class DevContainer(object):
>>           for bus in device.child_bus:
>>               self.__buses.insert(0, bus)
>>           # 4
>> -        if device.get_qid() and self.get_by_qid(device.get_qid()):
>> -            err = "Devices qid %s already used in VM\n" %
>> device.get_qid()
>> -            clean(device, added_devices)
>> -            raise DeviceInsertError(device, err, self)
>> -        device.set_aid(self.__create_unique_aid(device.get_qid()))
>> -        self.__devices.append(device)
>> -        added_devices.append(device)
>> -        return added_devices
>> +        return add(device, added_devices)
>>
>>       def simple_hotplug(self, device, monitor):
>>           """
>> @@ -1288,7 +1296,10 @@ class DevContainer(object):
>>               if strict_mode:
>>                   devices[-1].set_param('channel', 0)
>>           elif fmt == 'virtio':
>> -            devices[-1].set_param('driver', 'virtio-blk-pci')
>> +            if devices[-1].is_plat_device():
>> +                devices[-1].set_param('driver', 'virtio-blk-device')
>> +            else:
>> +                devices[-1].set_param('driver', 'virtio-blk-pci')
>>               devices[-1].set_param("scsi", scsi, bool)
>>               if bus is not None:
>>                   devices[-1].set_param('addr', hex(bus))
>> diff --git a/virttest/qemu_devices/qdevices.py
>> b/virttest/qemu_devices/qdevices.py
>> index b272e7d..b01e0d1 100644
>> --- a/virttest/qemu_devices/qdevices.py
>> +++ b/virttest/qemu_devices/qdevices.py
>> @@ -88,6 +88,27 @@ class QBaseDevice(object):
>>               for key, value in params.iteritems():
>>                   self.set_param(key, value)
>>
>> +    def is_plat_device(self):
>> +        def is_plat_bus(tbus):
>> +            if tbus.has_key('aobject'):
>> +                    if tbus.get('aobject') == 'platform':
>> +                        return True
>> +                    else:
>> +                        return False
>> +            return False
>> +
>> +        if self.parent_bus is None:
>> +            return False
>> +        tbus = self.parent_bus
>> +        if type(tbus) is dict and is_plat_bus(tbus) is True:
>> +            return True
>> +        for tbus in self.parent_bus:
>> +            if not type(tbus) is dict:
>> +                continue
>> +            if is_plat_bus(tbus) is True:
>> +                return True
>> +        return False
>> +
>>       def add_child_bus(self, bus):
>>           """
>>           Add child bus
>> diff --git a/virttest/qemu_vm.py b/virttest/qemu_vm.py
>> index 5c76e15..79b3d4e 100644
>> --- a/virttest/qemu_vm.py
>> +++ b/virttest/qemu_vm.py
>> @@ -559,8 +559,10 @@ class VM(virt_vm.BaseVM):
>>               if "virtio" in model:
>>                   if int(queues) > 1:
>>                       dev.set_param('mq', 'on')
>> -                if vectors:
>> +                if vectors and not dev.is_plat_device() is True:
>>                       dev.set_param('vectors', vectors)
>> +                if dev.is_plat_device():
>> +                    dev.set_param('driver', 'virtio-net-device')
>>               if devices.has_option("netdev"):
>>                   dev.set_param('netdev', netdev_id)
>>               else:
>>
>
> _______________________________________________
> Virt-test-devel mailing list
> [email protected]
> https://www.redhat.com/mailman/listinfo/virt-test-devel

Thanks,
--
Ming Lei

_______________________________________________
Virt-test-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-test-devel

Reply via email to