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: 3277141 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 65342C0D4A for ; Tue, 3 Dec 2013 15:47:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 45D7520220 for ; Tue, 3 Dec 2013 15:47:02 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E892E201F2 for ; Tue, 3 Dec 2013 15:47:00 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VnsBX-0007hX-2A; Tue, 03 Dec 2013 15:46:51 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VnsBU-0007wP-QV; Tue, 03 Dec 2013 15:46:48 +0000 Received: from mail-ee0-f52.google.com ([74.125.83.52]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VnsBR-0007vh-3q for linux-arm-kernel@lists.infradead.org; Tue, 03 Dec 2013 15:46:46 +0000 Received: by mail-ee0-f52.google.com with SMTP id d17so1455228eek.11 for ; Tue, 03 Dec 2013 07:46:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=40v0Ph56uMfEg1GfbAxLR0SpCIMaArg4YKF1bfq6qOU=; b=DH0T7UP7VKmkwY5WJ/iKxcbA/hZCfDlMKKAAu3M7Py0AO3eXEH52XY6mNtbRSzEUdo ULQUMe8MqXViNxBqoza5FeI7zG11LAUu+yauaoFYdHTHTrY3UH3S40ExggSC4ep30m2p fyeyAvENLyMU/SgbANn655ZIsF4PhtPMDxuxLQSZZCEgnssPLcwJP3YXZX1fBDOzydUL vCKaRqXdL4o3XLkyG508gd4l7aMdtL8PyB/acyePd3GDg6tjf8ukVFmqXKraVD3igOtW FaUoCVnkyaZQMLpFZtkC7hpltRID0OqySpbLjouN6y6Ad2WtsoI5bH9nYVkoR8SYMZJj KGuQ== X-Gm-Message-State: ALoCoQkqx4jfmsHDj3IZKbBUdJTVPsU1O2IVCd45Z1tuPs5dOcSyrTpGXwCmcSBRCh7YrGvMbChQ 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131203_104645_272124_76E0D0E9 X-CRM114-Status: GOOD ( 12.70 ) X-Spam-Score: -2.6 (--) Cc: Ian Campbell , Konrad Rzeszutek Wilk , Stefano Stabellini , Julien Grall , linux-kernel@vger.kernel.org, David Vrabel , patches@linaro.org, Boris Ostrovsky , linux-arm-kernel@lists.infradead.org, Roger Pau Monne X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 */