On 16/6/23 13:48, Kevin Wolf wrote:
Am 15.06.2023 um 00:56 hat Alexander Graf geschrieben:
Apple has its own virtio-blk PCI device ID where it deviates from the
official virtio-pci spec slightly: It puts a new "apple type"
field at a static offset in config space and introduces a new discard
command.
In other words, it's a different device. We shouldn't try to
differentiate only with a property, but actually model it as a separate
device.
I was thinking of qdev inheritance:
#define TYPE_VIRTIO_BLK_PCI_APPLE "virtio-blk-pci-apple"
OBJECT_DECLARE_SIMPLE_TYPE(VirtIOBlkPCIApple, TYPE_VIRTIO_BLK_PCI_APPLE)
struct VirtIOBlkPCIApple {
VirtIOBlkPCI parent_obj;
};
and add an optional custom handler in VirtioDeviceClass to handle the
VIRTIO_BLK_T_APPLE1 case.
This patch adds a new qdev property called "apple-type" to virtio-blk-pci.
When that property is set, we assume the virtio-blk device is an Apple one
of the specific type and act accordingly.
Do we have any information on what the number in "apple-type" actually
means or do we have to treat it as a black box?
Signed-off-by: Alexander Graf <g...@amazon.com>
---
hw/block/virtio-blk.c | 23 +++++++++++++++++++++
hw/virtio/virtio-blk-pci.c | 7 +++++++
include/hw/pci/pci_ids.h | 1 +
include/hw/virtio/virtio-blk.h | 1 +
include/standard-headers/linux/virtio_blk.h | 3 +++
5 files changed, 35 insertions(+)