From patchwork Tue Dec 3 15:40:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 21969 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6CF35202DA for ; Tue, 3 Dec 2013 15:41:06 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wo20sf46490766obc.5 for ; Tue, 03 Dec 2013 07:41:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=40v0Ph56uMfEg1GfbAxLR0SpCIMaArg4YKF1bfq6qOU=; b=eqC/A+UobfqP5jbaJZf8RTiffGyNzTO1YrGUq8OAaKIR2RdW/VF9wPE4KD83fxdw8I VPM0vWeVwa9w1pS3wRIx2og01pnrDNFds8r3U7HFFJ0x0YJeh6o9hZIiOQ4COqhr4r6q Q2y/57YVhqIFkV+hMsy5JoYvawgKL5ZpbxEIzy/sOt42C1E+k8lZwc9IMhQJGyp/S2Z4 FFRv9cSoxRlHDaXizFqilMF58JfId1uvM3JiAaf0ygy6VUwP4q2ca6ZVfg3fSkgLH5VK 3Ma8zBG5fYvHOYwjFw8GFoGt+sspOryvg/XgVkb7ZHYHhy6ILjqn6RK3Qa53zrYKueer FxaA== X-Gm-Message-State: ALoCoQk0pghdfeXtcdSOeidO4/6hjf5qdTI1WB3g+EA4C+UApWh7iE9xFrLpmx2ddZVcrKwHQ6t8 X-Received: by 10.42.65.138 with SMTP id l10mr777253ici.31.1386085265585; Tue, 03 Dec 2013 07:41:05 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.48.129 with SMTP id l1ls1123809qen.75.gmail; Tue, 03 Dec 2013 07:41:05 -0800 (PST) X-Received: by 10.52.168.4 with SMTP id zs4mr62493vdb.59.1386085265469; Tue, 03 Dec 2013 07:41:05 -0800 (PST) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id tl2si4329294vdc.103.2013.12.03.07.41.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Dec 2013 07:41:05 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id lf12so9974508vcb.35 for ; Tue, 03 Dec 2013 07:41:05 -0800 (PST) X-Received: by 10.58.180.227 with SMTP id dr3mr1838660vec.36.1386085265070; Tue, 03 Dec 2013 07:41:05 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp217970vcz; Tue, 3 Dec 2013 07:41:04 -0800 (PST) X-Received: by 10.15.32.73 with SMTP id z49mr71949068eeu.27.1386085264087; Tue, 03 Dec 2013 07:41:04 -0800 (PST) Received: from mail-ea0-f171.google.com (mail-ea0-f171.google.com [209.85.215.171]) by mx.google.com with ESMTPS id p46si3441416eem.231.2013.12.03.07.41.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Dec 2013 07:41:04 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.171 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=209.85.215.171; Received: by mail-ea0-f171.google.com with SMTP id h10so10118935eak.16 for ; Tue, 03 Dec 2013 07:41:03 -0800 (PST) X-Received: by 10.15.82.136 with SMTP id a8mr3352232eez.81.1386085263659; Tue, 03 Dec 2013 07:41:03 -0800 (PST) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id 1sm83691516eeg.4.2013.12.03.07.41.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Dec 2013 07:41:02 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Cc: patches@linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Julien Grall , Roger Pau Monne , Konrad Rzeszutek Wilk , David Vrabel , Boris Ostrovsky , Ian Campbell , Stefano Stabellini Subject: [PATCH v2] xen/block: Correctly define structures in public headers on ARM32 and ARM64 Date: Tue, 3 Dec 2013 15:40:37 +0000 Message-Id: <1386085237-8334-1-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On ARM (32 bits and 64 bits), the double-word is 8-bytes aligned. This will result on different structure from Xen and Linux repositories. As Linux is using __packed__ attribute, it must have a 4-bytes padding before each "id" field. This change breaks guest block support with older kernel. IMHO, it's acceptable because Xen on ARM is still on Tech Preview and the hypercall ABI is not yet freezed. Only one architecture (x86_32) doesn't have 64-bit ABI for the block interface. Don't add padding if Linux is compiled for this architecture. Signed-off-by: Julien Grall Cc: Roger Pau Monne Cc: Konrad Rzeszutek Wilk Cc: David Vrabel Cc: Boris Ostrovsky Cc: Ian Campbell Cc: Stefano Stabellini Acked-by: David Vrabel Acked-by: Roger Pau Monné --- Changes in v2: - Reverse define Changes in v1: - This patch is the rework of "xen-block: correctly define structures in public headers" sent by Roger (see https://lkml.org/lkml/2013/12/3/155). --- include/xen/interface/io/blkif.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/xen/interface/io/blkif.h b/include/xen/interface/io/blkif.h index 65e1209..ae665ac 100644 --- a/include/xen/interface/io/blkif.h +++ b/include/xen/interface/io/blkif.h @@ -146,7 +146,7 @@ struct blkif_request_segment_aligned { struct blkif_request_rw { uint8_t nr_segments; /* number of segments */ blkif_vdev_t handle; /* only for read/write requests */ -#ifdef CONFIG_X86_64 +#ifndef CONFIG_X86_32 uint32_t _pad1; /* offsetof(blkif_request,u.rw.id) == 8 */ #endif uint64_t id; /* private guest value, echoed in resp */ @@ -163,7 +163,7 @@ struct blkif_request_discard { uint8_t flag; /* BLKIF_DISCARD_SECURE or zero. */ #define BLKIF_DISCARD_SECURE (1<<0) /* ignored if discard-secure=0 */ blkif_vdev_t _pad1; /* only for read/write requests */ -#ifdef CONFIG_X86_64 +#ifndef CONFIG_X86_32 uint32_t _pad2; /* offsetof(blkif_req..,u.discard.id)==8*/ #endif uint64_t id; /* private guest value, echoed in resp */ @@ -175,7 +175,7 @@ struct blkif_request_discard { struct blkif_request_other { uint8_t _pad1; blkif_vdev_t _pad2; /* only for read/write requests */ -#ifdef CONFIG_X86_64 +#ifndef CONFIG_X86_32 uint32_t _pad3; /* offsetof(blkif_req..,u.other.id)==8*/ #endif uint64_t id; /* private guest value, echoed in resp */ @@ -184,7 +184,7 @@ struct blkif_request_other { struct blkif_request_indirect { uint8_t indirect_op; uint16_t nr_segments; -#ifdef CONFIG_X86_64 +#ifndef CONFIG_X86_32 uint32_t _pad1; /* offsetof(blkif_...,u.indirect.id) == 8 */ #endif uint64_t id; @@ -192,7 +192,7 @@ struct blkif_request_indirect { blkif_vdev_t handle; uint16_t _pad2; grant_ref_t indirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST]; -#ifdef CONFIG_X86_64 +#ifndef CONFIG_X86_32 uint32_t _pad3; /* make it 64 byte aligned */ #else uint64_t _pad3; /* make it 64 byte aligned */