Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/xen/include blkif_x86_{32,64}_* are not identical t...



details:   https://anonhg.NetBSD.org/src/rev/057642575b99
branches:  trunk
changeset: 998093:057642575b99
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sun Apr 07 12:23:54 2019 +0000

description:
blkif_x86_{32,64}_* are not identical to blkif_*, internal fields have
different alignements and this change their sizes. Copy them back from
their netbsd-8 definitions.
Fixes PR port-xen/54099

diffstat:

 sys/arch/xen/include/xenring.h |  46 +++++++++++++++++++++++++++++++++++------
 1 files changed, 39 insertions(+), 7 deletions(-)

diffs (62 lines):

diff -r 93e1cc6b8e33 -r 057642575b99 sys/arch/xen/include/xenring.h
--- a/sys/arch/xen/include/xenring.h    Sun Apr 07 12:21:20 2019 +0000
+++ b/sys/arch/xen/include/xenring.h    Sun Apr 07 12:23:54 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xenring.h,v 1.3 2019/02/02 15:09:32 cherry Exp $ */
+/* $NetBSD: xenring.h,v 1.4 2019/04/07 12:23:54 bouyer Exp $ */
 
 /*
  * Glue goop for xbd ring request/response protocol structures.
@@ -32,14 +32,46 @@
  * Define ring types. These were previously part of the public API.
  * Not anymore.
  */
-DEFINE_RING_TYPES(blkif_x86_32, struct blkif_request, struct blkif_response);
-DEFINE_RING_TYPES(blkif_x86_64, struct blkif_request, struct blkif_response);
+/* i386 requests/responses */
+struct blkif_x86_32_request {
+    uint8_t        operation;    /* BLKIF_OP_???                         */
+    uint8_t        nr_segments;  /* number of segments                   */
+    blkif_vdev_t   handle;       /* only for read/write requests         */
+    uint64_t       id;           /* private guest value, echoed in resp  */
+    blkif_sector_t sector_number;/* start sector idx on disk (r/w only)  */
+    struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
+} __packed;
+typedef struct blkif_x86_32_request blkif_x86_32_request_t;
+
+struct blkif_x86_32_response {
+    uint64_t        id;              /* copied from request */
+    uint8_t         operation;       /* copied from request */
+    uint8_t         _pad;
+    int16_t         status;          /* BLKIF_RSP_???       */
+} __packed;
+typedef struct blkif_x86_32_response blkif_x86_32_response_t;
 
-typedef struct blkif_request blkif_x86_64_request_t;
-typedef struct blkif_response blkif_x86_64_response_t;
-typedef struct blkif_request blkif_x86_32_request_t;
-typedef struct blkif_response blkif_x86_32_response_t;
+/* amd64-type requests/responses (always used in frontends ) */
 
+struct blkif_x86_64_request {
+    uint8_t        operation;    /* BLKIF_OP_???                         */
+    uint8_t        nr_segments;  /* number of segments                   */
+    blkif_vdev_t   handle;       /* only for read/write requests         */
+    uint64_t __attribute__((__aligned__(8))) id;/* private guest value, echoed in resp  */
+    blkif_sector_t sector_number;/* start sector idx on disk (r/w only)  */
+    struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
+};
+typedef struct blkif_x86_64_request blkif_x86_64_request_t;
+
+struct blkif_x86_64_response {
+    uint64_t __attribute__((__aligned__(8))) id; /* copied from request */
+    uint8_t         operation;       /* copied from request */
+    int16_t         status;          /* BLKIF_RSP_???       */
+};
+typedef struct blkif_x86_64_response blkif_x86_64_response_t;
+
+DEFINE_RING_TYPES(blkif_x86_32, struct blkif_x86_32_request, struct blkif_x86_32_response);
+DEFINE_RING_TYPES(blkif_x86_64, struct blkif_x86_64_request, struct blkif_x86_64_response);
 
 union blkif_back_ring_proto {
        blkif_back_ring_t ring_n; /* native/common members */



Home | Main Index | Thread Index | Old Index