From nobody Thu Dec 18 19:36:23 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1600092814; cv=none; d=zohomail.com; s=zohoarc; b=CDdCHBcQrW3qwYWlGqP5IvSxHhMP2+fTxIJsWoyFt19uY9tHdWsbszbVDI+cCuS9W65PJ4s2Pm6pDiqG3KAAxL2sIlUqVwlxxupd9XbPyOzonz6BaNbCsLtar6Mlxzuk63N5KC00alRr+tKCyaScIWPJ9YtkKMJKXtujeR3R7Ow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600092814; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=m58pknpN2eQ1zzjiR2a1sQi0/6/l0QeEv7UO1WaHIi8=; b=kIVJHyxOjR5vYG2GAyUlETQ0JfSQxm9ZC9Vl4n9dWG0ShSwy7fxIz6QxPuJqdHbE5zqo8njqsHl3nQoOrIleYFwh8ld7wWodcP3Jwchh9bz3aDNqXWP/8rUP1Vnr6QUQjzmsP62OM/B/DapXlf9hz5pCuGFTtGhkkz0WXKTjfvc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600092814097899.6001908658393; Mon, 14 Sep 2020 07:13:34 -0700 (PDT) Received: from localhost ([::1]:47372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kHpEa-0004H8-3n for importer@patchew.org; Mon, 14 Sep 2020 10:13:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kHp85-0001zr-8h for qemu-devel@nongnu.org; Mon, 14 Sep 2020 10:06:49 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:37004) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kHp83-0007WZ-8d for qemu-devel@nongnu.org; Mon, 14 Sep 2020 10:06:48 -0400 Received: by mail-wm1-x32b.google.com with SMTP id a9so200029wmm.2 for ; Mon, 14 Sep 2020 07:06:46 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id x16sm20834041wrq.62.2020.09.14.07.06.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2020 07:06:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=m58pknpN2eQ1zzjiR2a1sQi0/6/l0QeEv7UO1WaHIi8=; b=BUPWdWLj5lr4//snkkju6UGzqK510rONeVkRhpe2DGtPwqyhEU5GJ6A0+P6g4bHLc3 3URXJjXc+x+uCzwgVKQ6xU50ArBXWtHw5o9nRl/0AOGfZrM8SgFAYMWSgYDLAR+98X+j HCh5cQ8YcCNKZypc5dQ8aqcPC/zKHqns9iWCYVHsKL9VJm2bx0H+6nZikrUPUonduQWP NDuR4HrKSulVCkLx/0HqnlN8kSl9F9bXqv1Oty1675HMpXfpW3V9GQv1i6ammEna73xZ IcTuFR4Bfv1J8IuEq2BdxTuQQsMjALGrXd03h2UC0VEsNIFBYBKauUIxOu9rCOSOEmvm qgFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=m58pknpN2eQ1zzjiR2a1sQi0/6/l0QeEv7UO1WaHIi8=; b=PU8yovmzD4ufZxbvXhgJ0psSEuEQKGnGrfBYlPqrsBfQl4sQI3sGTnKhMly9ggLjc2 asax/RdRPLOks2KdFdOVGfeNShpOj9gWck1218M0gtGU8iXFGFb0vxcaEY5rP9ARHUz/ EEVi1qM6aQuBTwrSOPBPsMQWDUKZKHF7VCXSIplSl89IP3cLrAuiE/Oy2zb00KT9AvqW ukZGyLbkycSJLweji8Bm/s3bdw6u8mnq5vM0EmsMdn9vhx6BvOkFa0oAM1K9qhb8jChV PvlfwL29DPgOzenEf3FgR4AQwbto2INZAFGKYNHeExf3E5a7FncFoKrUEtkjIiV50ql/ 5Oug== X-Gm-Message-State: AOAM530FW+eqYgiSr2V+XKL7Vli34wTJJUv1/SDZsuw8rVKBpZDLb4Gi 7uKGjglEuzH+BPyLOdt3WHix59WqM0iTbqvl X-Google-Smtp-Source: ABdhPJydgzG3W2qROdYdxxOWcuWzc3/HHGXSGk9VdZ9n78ANM2hmi9zy8BNL0479kYSISS9BR8Zzcg== X-Received: by 2002:a1c:4054:: with SMTP id n81mr14850773wma.81.1600092405755; Mon, 14 Sep 2020 07:06:45 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/36] hw/misc/a9scu: Simplify setting MemoryRegionOps::valid fields Date: Mon, 14 Sep 2020 15:06:07 +0100 Message-Id: <20200914140641.21369-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200914140641.21369-1-peter.maydell@linaro.org> References: <20200914140641.21369-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32b.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Philippe Mathieu-Daud=C3=A9 Per the datasheet (DDI0407 r2p0): "All SCU registers are byte accessible" and are 32-bit aligned. Set MemoryRegionOps::valid min/max fields and simplify the write() handler. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-id: 20200901144100.116742-3-f4bug@amsat.org Signed-off-by: Peter Maydell --- hw/misc/a9scu.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/hw/misc/a9scu.c b/hw/misc/a9scu.c index 915f127761e..3f3dcc414fe 100644 --- a/hw/misc/a9scu.c +++ b/hw/misc/a9scu.c @@ -52,23 +52,8 @@ static void a9_scu_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { A9SCUState *s =3D (A9SCUState *)opaque; - uint32_t mask; + uint32_t mask =3D MAKE_64BIT_MASK(0, size * 8); uint32_t shift; - switch (size) { - case 1: - mask =3D 0xff; - break; - case 2: - mask =3D 0xffff; - break; - case 4: - mask =3D 0xffffffff; - break; - default: - fprintf(stderr, "Invalid size %u in write to a9 scu register %x\n", - size, (unsigned)offset); - return; - } =20 switch (offset) { case 0x00: /* Control */ @@ -99,6 +84,10 @@ static void a9_scu_write(void *opaque, hwaddr offset, static const MemoryRegionOps a9_scu_ops =3D { .read =3D a9_scu_read, .write =3D a9_scu_write, + .valid =3D { + .min_access_size =3D 1, + .max_access_size =3D 4, + }, .endianness =3D DEVICE_NATIVE_ENDIAN, }; =20 --=20 2.20.1