From patchwork Wed Dec 5 22:11:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 10714977 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A58E013BB for ; Wed, 5 Dec 2018 22:12:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 965272E78B for ; Wed, 5 Dec 2018 22:12:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87F6D2E76B; Wed, 5 Dec 2018 22:12:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A207F2E788 for ; Wed, 5 Dec 2018 22:12:50 +0000 (UTC) Received: from localhost ([::1]:37148 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUfPV-0000nF-3i for patchwork-qemu-devel@patchwork.kernel.org; Wed, 05 Dec 2018 17:12:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35778) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUfOp-0000Mc-1G for qemu-devel@nongnu.org; Wed, 05 Dec 2018 17:12:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUfOl-0002ia-57 for qemu-devel@nongnu.org; Wed, 05 Dec 2018 17:12:07 -0500 Received: from mail-eopbgr820115.outbound.protection.outlook.com ([40.107.82.115]:36150 helo=NAM01-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUfOi-0002Ux-BU for qemu-devel@nongnu.org; Wed, 05 Dec 2018 17:12:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wavesemi.onmicrosoft.com; s=selector1-wavecomp-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r9t4G/DpfDAHe0WstvFfv76Xdj87f0d3j79MLSfRGFQ=; b=TokyjrDe4RjNg35yv+LtzMAiAJYApjIJpWot7THcBMxikftu1jq/0xUBsSo0K8Kl3xbxBpELoMECbhoIH21r5D5ocsciiISUqoYqBySLrxhvHDC+teTPPeccc/YBKf3oh0PQ2QKX8+yOe+xj5rKKNn1/x47v3BQXptSuG0gou08= Received: from MWHPR2201MB1277.namprd22.prod.outlook.com (10.174.162.17) by MWHPR2201MB1391.namprd22.prod.outlook.com (10.172.63.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.22; Wed, 5 Dec 2018 22:11:44 +0000 Received: from MWHPR2201MB1277.namprd22.prod.outlook.com ([fe80::2d92:328e:af42:2985]) by MWHPR2201MB1277.namprd22.prod.outlook.com ([fe80::2d92:328e:af42:2985%4]) with mapi id 15.20.1404.020; Wed, 5 Dec 2018 22:11:44 +0000 From: Paul Burton To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH] atomic.h: Set ATOMIC_REG_SIZE=8 for MIPS n32 Thread-Index: AQHUjOeB+wzc0Xh+EU+raAHW4Lo/Qw== Date: Wed, 5 Dec 2018 22:11:43 +0000 Message-ID: <20181205221126.16220-1-paul.burton@mips.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MWHPR21CA0063.namprd21.prod.outlook.com (2603:10b6:300:db::25) To MWHPR2201MB1277.namprd22.prod.outlook.com (2603:10b6:301:24::17) authentication-results: spf=none (sender IP is ) smtp.mailfrom=pburton@wavecomp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [2601:640:100:a82b:331a:3193:9711:95bb] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR2201MB1391; 6:+rh+SQ/RAMY3CbEpcUsdc0SeUcdV1Wfbt649NkFdJkzMv6eBXLg9JevPhlGjZAVurhO0h+EjCQtFppqKVZXKNtF1CRh9Ya3AKS0hughWw/mvyJu4Fh0gk5TASiKCjN4sKkefag4rSJMVPu//h+i4WkdH5mRcQoOupaTvYHH/fZ7ulWAjGczuYQt+O/o+7nUqLa0MOLAR6hXLUaOP7THB5m2rQl30c2ePA2wHU0Uh243qWTiw35H2w7qI16pUktp2SZLERSWiI/At0vmffQuXKkhAAymt9hEVzlZQHoLu5qhP0IixaTq8/boiaxC5tSwWyaSz6vD/ZysDpMJlv3u3GuF0MTe2cuFGaV0iAOXjmOrgOsS55w12/hMhilWfsEd2rXRVag7MYxIeGa8dibM1C+8kAeCQYNcCIYC+uacUs00mLa7KSqbAu1uvK9DSV2DXzWEhbMe/9o5P2dZthUljgw==; 5:BX0/JK7sKTaApw/WvJYX+wgOqUSSmfaUZw0zO8KqSo+LhItyReVEsYYQ3Nk52tZpJp3F2AlB4bojmgSHGo4srvXjvs0uAE9aArQ/yFAxliA4Xfg1LWUIKIzTWKean1pc22J4T/pbV7cKc7t7C0c9vsDTdZwYM9tIfEFjQgZh4s0=; 7:kwldXiEs/uSY5vxSWUErLCij79Fh0FVJicflGpcGEOS3wmjBh2uJiIeL1ApXUHlUCv0bRsj5/lg8mrrJAOIUfjGTDIfnG4mDCDSMMaGJuEXZjWxwqWYchz3RFMOibNuOcg3TfbcpitXShittHjJmBQ== x-ms-office365-filtering-correlation-id: 44fcee6d-0b2b-4cb2-9640-08d65afea3de x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(7021145)(8989299)(5600074)(711020)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(2017052603328)(7153060)(7193020); SRVR:MWHPR2201MB1391; x-ms-traffictypediagnostic: MWHPR2201MB1391: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(3002001)(93006095)(3231455)(999002)(944501520)(52105112)(10201501046)(148016)(149066)(150057)(6041310)(2016111802025)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(6043046)(201708071742011)(7699051)(76991095); SRVR:MWHPR2201MB1391; BCL:0; PCL:0; RULEID:; SRVR:MWHPR2201MB1391; x-forefront-prvs: 08770259B4 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(376002)(136003)(396003)(366004)(39850400004)(199004)(189003)(6512007)(53936002)(6916009)(71190400001)(6436002)(71200400001)(14454004)(6486002)(256004)(97736004)(2501003)(25786009)(508600001)(7736002)(305945005)(42882007)(8676002)(8936002)(6506007)(36756003)(52116002)(81166006)(44832011)(68736007)(81156014)(54906003)(386003)(102836004)(186003)(107886003)(476003)(486006)(6116002)(5660300001)(316002)(4326008)(1076002)(2616005)(105586002)(106356001)(5640700003)(2906002)(2351001)(99286004)(46003); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR2201MB1391; H:MWHPR2201MB1277.namprd22.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: wavecomp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: fjKD+8eD2iZMcfkdRZJo6A+fMmZuj/6Wn50dXWjqZDmp5stDGasJ27kIFtTA81COcGt9CaLYj4FvtZttPJP7c0HuleB13a9CVNovtxL2qa7baz3K5hc++fTs+IxxbEb81VAaqkKWZqgQjSy8n3DAZ8aYjtwaIbdfAWLVEMr7A/NIAaXbHMu4fDMKTqjXSEM7CSVOwe0wrEX7iTUJ4Go3hGXW2FCFirh0IKrsq7eoDl+D7hD10yR7tzBMT5R3C3OkZtjQ1W4LUnYnwZSsgDMRI/JHtYsq3Y4d7YrWCTJRG93lqJ2dwu99/LXHLGg1Ei9TvnHcr3WbSALCNd9CQF8+qlPRVj6I1QHtF5afngvK75I= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: mips.com X-MS-Exchange-CrossTenant-Network-Message-Id: 44fcee6d-0b2b-4cb2-9640-08d65afea3de X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Dec 2018 22:11:44.0013 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 463607d3-1db3-40a0-8a29-970c56230104 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR2201MB1391 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.82.115 Subject: [Qemu-devel] [PATCH] atomic.h: Set ATOMIC_REG_SIZE=8 for MIPS n32 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Burton , =?iso-8859-1?q?Alex_Benn=E9e?= , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP ATOMIC_REG_SIZE is currently defined as the default sizeof(void *) for all MIPS host builds, including those using the n32 ABI. n32 is the MIPS64 ILP32 ABI and as such tcg/mips/tcg-target.h defines TCG_TARGET_REG_BITS as 64 for n32 builds. If we attempt to build QEMU for an n32 host with support for a 64b target architecture then TCG_OVERSIZED_GUEST is 0 and accel/tcg/cputlb.c attempts to use atomic_* functions. This fails because ATOMIC_REG_SIZE is 4, causing the calls to QEMU_BUILD_BUG_ON(sizeof(*ptr) > ATOMIC_REG_SIZE) in the various atomic_* functions to generate errors. Fix this by defining ATOMIC_REG_SIZE as 8 for all MIPS64 builds, which will cover both n32 (ILP32) & n64 (LP64) ABIs in much the same was as we already do for x86_64/x32. Signed-off-by: Paul Burton Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- include/qemu/atomic.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h index f6993a8fb1..a6ac188188 100644 --- a/include/qemu/atomic.h +++ b/include/qemu/atomic.h @@ -99,9 +99,10 @@ * those few cases by hand. * * Note that x32 is fully detected with __x86_64__ + _ILP32, and that for - * Sparc we always force the use of sparcv9 in configure. + * Sparc we always force the use of sparcv9 in configure. MIPS n32 (ILP32) & + * n64 (LP64) ABIs are both detected using __mips64. */ -#if defined(__x86_64__) || defined(__sparc__) +#if defined(__x86_64__) || defined(__sparc__) || defined(__mips64) # define ATOMIC_REG_SIZE 8 #else # define ATOMIC_REG_SIZE sizeof(void *)