From: Hannes Reinecke <hare@suse.de>
To: Alexander Bezzubikov <zuban32s@gmail.com>, qemu-devel@nongnu.org
Cc: jsnow@redhat.com, abezzubikov@ispras.ru
Subject: Re: [Qemu-devel] [PATCH RFC 01/11] ide: ATAPI-SCSI bridge TypeInfo and init function created
Date: Tue, 18 Aug 2015 08:07:40 +0200 [thread overview]
Message-ID: <55D2CBAC.7000302@suse.de> (raw)
In-Reply-To: <1439854945-5597-2-git-send-email-abezzubikov@ispras.ru>
On 08/18/2015 01:42 AM, Alexander Bezzubikov wrote:
> Signed-off-by: Alexander Bezzubikov <abezzubikov@ispras.ru>
> ---
> hw/ide/bridge.h | 9 +++++++++
> hw/ide/internal.h | 3 ++-
> hw/ide/qdev.c | 40 ++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 51 insertions(+), 1 deletion(-)
> create mode 100644 hw/ide/bridge.h
>
> diff --git a/hw/ide/bridge.h b/hw/ide/bridge.h
> new file mode 100644
> index 0000000..dca5d73
> --- /dev/null
> +++ b/hw/ide/bridge.h
> @@ -0,0 +1,9 @@
> +#ifndef HW_IDE_BRIDGE_H
> +#define HW_IDE_BRIDGE_H
> +
> +#include "hw/ide/internal.h"
> +
> +void ide_bridge_start_transfer(SCSIRequest *req, uint32_t len);
> +void ide_bridge_complete(SCSIRequest *req, uint32_t status, size_t resid);
> +
> +#endif
> diff --git a/hw/ide/internal.h b/hw/ide/internal.h
> index 30fdcbc..f2999ce 100644
> --- a/hw/ide/internal.h
> +++ b/hw/ide/internal.h
> @@ -12,6 +12,7 @@
> #include "sysemu/sysemu.h"
> #include "hw/block/block.h"
> #include "block/scsi.h"
> +#include "hw/scsi/scsi.h"
>
> /* debug IDE devices */
> //#define DEBUG_IDE
> @@ -317,7 +318,7 @@ typedef struct IDEDMAOps IDEDMAOps;
> #define SMART_DISABLE 0xd9
> #define SMART_STATUS 0xda
>
> -typedef enum { IDE_HD, IDE_CD, IDE_CFATA } IDEDriveKind;
> +typedef enum { IDE_HD, IDE_CD, IDE_CFATA, IDE_BRIDGE } IDEDriveKind;
>
> typedef void EndTransferFunc(IDEState *);
>
This change doesn't need the scsi.h include; please move it to the
patch where the SCSI prototypes are used.
> diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
> index 788b361..e96a6e9 100644
> --- a/hw/ide/qdev.c
> +++ b/hw/ide/qdev.c
> @@ -25,6 +25,7 @@
> #include "hw/block/block.h"
> #include "sysemu/sysemu.h"
> #include "qapi/visitor.h"
> +#include "hw/ide/bridge.h"
>
> /* --------------------------------- */
>
> @@ -143,6 +144,17 @@ int ide_get_bios_chs_trans(BusState *bus, int unit)
> return DO_UPCAST(IDEBus, qbus, bus)->ifs[unit].chs_trans;
> }
>
> +/* BusInfo structure for ATAPI-SCSI bridge */
> +static const struct SCSIBusInfo atapi_scsi_info = {
> + .tcq = true,
> + .max_target = 0,
> + .max_lun = 0,
> +
> + .transfer_data = NULL,
> + .complete = NULL,
> + .cancel = NULL
> +};
> +
> /* --------------------------------- */
>
> typedef struct IDEDrive {
> @@ -184,6 +196,11 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind)
> dev->chs_trans) < 0) {
> return -1;
> }
> + if (kind == IDE_BRIDGE) {
> + scsi_bus_new(&dev->scsi_bus, sizeof(dev->scsi_bus), &dev->qdev,
> + &atapi_scsi_info, NULL);
> + scsi_bus_legacy_handle_cmdline(&dev->scsi_bus, NULL);
> + }
>
> if (!dev->version) {
> dev->version = g_strdup(s->version);
> @@ -253,6 +270,11 @@ static int ide_cd_initfn(IDEDevice *dev)
> return ide_dev_initfn(dev, IDE_CD);
> }
>
> +static int ide_bridge_initfn(IDEDevice *dev)
> +{
> + return ide_dev_initfn(dev, IDE_BRIDGE);
> +}
> +
> static int ide_drive_initfn(IDEDevice *dev)
> {
> DriveInfo *dinfo = blk_legacy_dinfo(dev->conf.blk);
> @@ -314,6 +336,23 @@ static const TypeInfo ide_cd_info = {
> .class_init = ide_cd_class_init,
> };
>
> +static void ide_bridge_class_init(ObjectClass *klass, void *data)
> +{
> + DeviceClass *dc = DEVICE_CLASS(klass);
> + IDEDeviceClass *k = IDE_DEVICE_CLASS(klass);
> + k->init = ide_bridge_initfn;
> + dc->fw_name = "drive";
> + dc->desc = "virtual ATAPI-SCSI bridge";
> + dc->props = ide_cd_properties;
> +}
> +
> +static const TypeInfo ide_bridge_info = {
> + .name = "ide-bridge",
> + .parent = TYPE_IDE_DEVICE,
> + .instance_size = sizeof(IDEDrive),
> + .class_init = ide_bridge_class_init,
> +};
> +
> static Property ide_drive_properties[] = {
> DEFINE_IDE_DEV_PROPERTIES(),
> DEFINE_PROP_END_OF_LIST(),
> @@ -360,6 +399,7 @@ static void ide_register_types(void)
> type_register_static(&ide_bus_info);
> type_register_static(&ide_hd_info);
> type_register_static(&ide_cd_info);
> + type_register_static(&ide_bridge_info);
> type_register_static(&ide_drive_info);
> type_register_static(&ide_device_type_info);
> }
>
The rest is okay.
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
next prev parent reply other threads:[~2015-08-18 6:07 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-17 23:42 [Qemu-devel] [PATCH RFC 00/11] QEMU ATAPI-SCSI bridge GSoC project Alexander Bezzubikov
2015-08-17 23:42 ` [Qemu-devel] [PATCH RFC 01/11] ide: ATAPI-SCSI bridge TypeInfo and init function created Alexander Bezzubikov
2015-08-18 6:07 ` Hannes Reinecke [this message]
2015-08-17 23:42 ` [Qemu-devel] [PATCH RFC 02/11] ide: necessary fields for ATAPI-SCSI bridge added Alexander Bezzubikov
2015-08-18 6:08 ` Hannes Reinecke
2015-08-18 23:50 ` Thomas Huth
2015-08-19 5:56 ` Hannes Reinecke
2015-08-17 23:42 ` [Qemu-devel] [PATCH RFC 03/11] ide: necessary checks corrected to treat ATAPI-SCSI bridge as CDROM Alexander Bezzubikov
2015-08-18 6:09 ` Hannes Reinecke
2015-08-17 23:42 ` [Qemu-devel] [PATCH RFC 04/11] scsi: Added function to enable ATAPI-SCSI bridge send SCSI requests Alexander Bezzubikov
2015-08-18 6:10 ` Hannes Reinecke
2015-08-17 23:42 ` [Qemu-devel] [PATCH RFC 05/11] ide: bridge 'transfer' and 'complete' functions added Alexander Bezzubikov
2015-08-18 6:11 ` Hannes Reinecke
2015-08-17 23:42 ` [Qemu-devel] [PATCH RFC 06/11] ide: ATAPI-SCSI bridge can now forward requests to SCSI Alexander Bezzubikov
2015-08-18 6:12 ` Hannes Reinecke
2015-08-17 23:42 ` [Qemu-devel] [PATCH RFC 07/11] ide: Makefile corrected due to bridge creation Alexander Bezzubikov
2015-08-18 6:13 ` Hannes Reinecke
2015-08-17 23:42 ` [Qemu-devel] [PATCH RFC 08/11] scsi: SCSIDiskReq declaration moved to header Alexander Bezzubikov
2015-08-18 6:17 ` Hannes Reinecke
2015-08-25 0:31 ` John Snow
2015-08-17 23:42 ` [Qemu-devel] [PATCH RFC 09/11] ide: ide_bridge_do_transfer is treated as PIO transfer Alexander Bezzubikov
2015-08-18 6:18 ` Hannes Reinecke
2015-08-17 23:42 ` [Qemu-devel] [PATCH RFC 10/11] ide: corrected ATAPI checks to be ignored by ATAPI-SCSI bridge Alexander Bezzubikov
2015-08-18 6:19 ` Hannes Reinecke
2015-08-17 23:42 ` [Qemu-devel] [PATCH RFC 11/11] ide: bridge functions assigned to SCSIBusInfo, bridge is OK now Alexander Bezzubikov
2015-08-18 6:19 ` Hannes Reinecke
2015-08-18 6:21 ` [Qemu-devel] [PATCH RFC 00/11] QEMU ATAPI-SCSI bridge GSoC project Hannes Reinecke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55D2CBAC.7000302@suse.de \
--to=hare@suse.de \
--cc=abezzubikov@ispras.ru \
--cc=jsnow@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=zuban32s@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).