From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28277C19759 for ; Wed, 7 Aug 2019 08:35:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F3F17229F7 for ; Wed, 7 Aug 2019 08:35:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F3F17229F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bt.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38574 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hvHPY-0005y3-9H for qemu-devel@archiver.kernel.org; Wed, 07 Aug 2019 04:35:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44978) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hvHMH-0007jn-Da for qemu-devel@nongnu.org; Wed, 07 Aug 2019 04:31:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hvHME-0002A3-LD for qemu-devel@nongnu.org; Wed, 07 Aug 2019 04:31:45 -0400 Received: from smtpe1.intersmtp.com ([62.239.224.234]:36079) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hvHM3-000220-EU; Wed, 07 Aug 2019 04:31:31 -0400 Received: from tpw09926dag18e.domain1.systemhost.net (10.9.212.18) by RDW083A012ED68.bt.com (10.187.98.38) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 7 Aug 2019 09:31:06 +0100 Received: from tpw09926dag18e.domain1.systemhost.net (10.9.212.18) by tpw09926dag18e.domain1.systemhost.net (10.9.212.18) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 7 Aug 2019 09:31:28 +0100 Received: from tpw09926dag18e.domain1.systemhost.net ([fe80::a946:6348:ccf4:fa6c]) by tpw09926dag18e.domain1.systemhost.net ([fe80::a946:6348:ccf4:fa6c%12]) with mapi id 15.00.1395.000; Wed, 7 Aug 2019 09:31:28 +0100 From: To: Thread-Topic: [Qemu-devel] [PATCH v6 16/26] exec: Map device_endian onto MemOp Thread-Index: AQHVTPqBizwOZ0pOOka1lx5iTeYAMw== Date: Wed, 7 Aug 2019 08:31:28 +0000 Message-ID: <1565166687895.25037@bt.com> References: <45ec4924e0b34a3d9124e2db06af75b4@tpw09926dag18e.domain1.systemhost.net> In-Reply-To: <45ec4924e0b34a3d9124e2db06af75b4@tpw09926dag18e.domain1.systemhost.net> Accept-Language: en-AU, en-GB, en-US Content-Language: en-AU X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.187.101.44] MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 62.239.224.234 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 Subject: [Qemu-devel] [PATCH v6 16/26] exec: Map device_endian onto MemOp X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, peter.maydell@linaro.org, walling@linux.ibm.com, cohuck@redhat.com, sagark@eecs.berkeley.edu, david@redhat.com, jasowang@redhat.com, palmer@sifive.com, mark.cave-ayland@ilande.co.uk, i.mitsyanko@gmail.com, keith.busch@intel.com, jcmvbkbc@gmail.com, frederic.konrad@adacore.com, dmitry.fleytman@gmail.com, kraxel@redhat.com, edgar.iglesias@gmail.com, gxt@mprc.pku.edu.cn, pburton@wavecomp.com, xiaoguangrong.eric@gmail.com, peter.chubb@nicta.com.au, philmd@redhat.com, robh@kernel.org, hare@suse.com, sstabellini@kernel.org, berto@igalia.com, chouteau@adacore.com, qemu-block@nongnu.org, arikalo@wavecomp.com, jslaby@suse.cz, deller@gmx.de, mst@redhat.com, magnus.damm@gmail.com, jcd@tribudubois.net, pasic@linux.ibm.com, borntraeger@de.ibm.com, mreitz@redhat.com, hpoussin@reactos.org, joel@jms.id.au, anthony.perard@citrix.com, xen-devel@lists.xenproject.org, david@gibson.dropbear.id.au, lersek@redhat.com, green@moxielogic.com, atar4qemu@gmail.com, antonynpavlov@gmail.com, marex@denx.de, jiri@resnulli.us, ehabkost@redhat.com, minyard@acm.org, qemu-s390x@nongnu.org, sw@weilnetz.de, alistair@alistair23.me, yuval.shaia@oracle.com, b.galvani@gmail.com, eric.auger@redhat.com, alex.williamson@redhat.com, qemu-arm@nongnu.org, jan.kiszka@web.de, clg@kaod.org, stefanha@redhat.com, marcandre.lureau@redhat.com, shorne@gmail.com, jsnow@redhat.com, rth@twiddle.net, kwolf@redhat.com, qemu-riscv@nongnu.org, proljc@gmail.com, pbonzini@redhat.com, andrew@aj.id.au, kbastian@mail.uni-paderborn.de, crwulff@gmail.com, laurent@vivier.eu, Andrew.Baumann@microsoft.com, sundeep.lkml@gmail.com, andrew.smirnov@gmail.com, michael@walle.cc, paul.durrant@citrix.com, qemu-ppc@nongnu.org, huth@tuxfamily.org, amarkovic@wavecomp.com, imammedo@redhat.com, aurelien@aurel32.net, stefanb@linux.ibm.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Preparation to replace device_endian with MemOp. Mapping device_endian onto MemOp limits behaviour changes to this relatively smaller patch. The next patch will replace all device_endian usages with the equivalent MemOp. That patch will be large but have no behaviour changes. A subsequent patch will then delete unused device_endian. Signed-off-by: Tony Nguyen --- hw/char/serial.c | 18 ++++++------------ include/exec/cpu-common.h | 10 +++++++--- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/hw/char/serial.c b/hw/char/serial.c index 7c42a2a..7345f69 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -1012,22 +1012,15 @@ static void serial_mm_write(void *opaque, hwaddr ad= dr, serial_ioport_write(s, addr >> s->it_shift, value, 1); } -static const MemoryRegionOps serial_mm_ops[3] =3D { - [DEVICE_NATIVE_ENDIAN] =3D { - .read =3D serial_mm_read, - .write =3D serial_mm_write, - .endianness =3D DEVICE_NATIVE_ENDIAN, - .valid.max_access_size =3D 8, - .impl.max_access_size =3D 8, - }, - [DEVICE_LITTLE_ENDIAN] =3D { +static const MemoryRegionOps serial_mm_ops[2] =3D { + [0] =3D { .read =3D serial_mm_read, .write =3D serial_mm_write, .endianness =3D DEVICE_LITTLE_ENDIAN, .valid.max_access_size =3D 8, .impl.max_access_size =3D 8, }, - [DEVICE_BIG_ENDIAN] =3D { + [1] =3D { .read =3D serial_mm_read, .write =3D serial_mm_write, .endianness =3D DEVICE_BIG_ENDIAN, @@ -1053,8 +1046,9 @@ SerialState *serial_mm_init(MemoryRegion *address_spa= ce, serial_realize_core(s, &error_fatal); vmstate_register(NULL, base, &vmstate_serial, s); - memory_region_init_io(&s->io, NULL, &serial_mm_ops[end], s, - "serial", 8 << it_shift); + memory_region_init_io(&s->io, NULL, + &serial_mm_ops[end =3D=3D DEVICE_LITTLE_ENDIAN ?= 0 : 1], + s, "serial", 8 << it_shift); memory_region_add_subregion(address_space, base, &s->io); return s; } diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index f7dbe75..c388453 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -16,10 +16,14 @@ void tcg_flush_softmmu_tlb(CPUState *cs); #if !defined(CONFIG_USER_ONLY) +#include "exec/memop.h" + enum device_endian { - DEVICE_NATIVE_ENDIAN, - DEVICE_BIG_ENDIAN, - DEVICE_LITTLE_ENDIAN, +#ifdef NEED_CPU_H + DEVICE_NATIVE_ENDIAN =3D MO_TE, +#endif + DEVICE_BIG_ENDIAN =3D MO_BE, + DEVICE_LITTLE_ENDIAN =3D MO_LE, }; #if defined(HOST_WORDS_BIGENDIAN) -- 1.8.3.1 ?