From patchwork Sat Jan 22 18:24:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 534108 Delivered-To: patch@linaro.org Received: by 2002:ac0:f7d2:0:0:0:0:0 with SMTP id i18csp1671655imr; Sat, 22 Jan 2022 10:28:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJz6w6XnDozf3DXEGq5zsLvAN6nw8hLh/hYGAvs1CiPVyJukErvxglhfW0NNl3q7yOu2f2np X-Received: by 2002:a05:6902:1107:: with SMTP id o7mr8516451ybu.270.1642876126384; Sat, 22 Jan 2022 10:28:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642876126; cv=none; d=google.com; s=arc-20160816; b=ldIYSKbePO9qfndypkDjywLpMN2rNuyKsxG5dtFOr5XlcpQh2ZJnA+MwtFHIKNz9lP bHPR8QdYbHnAtHO9Cj7tGwa/b/6Hk1u/EJcBXvFpd7DLiI7LCq0bHQ7cKif6LiMhHOhI yoVpR2RdTyLHcVHU4Mt0K03x9gaWB6PnNu25HnDEj5DdiYwsrlKM47/otcFNTq6eopLG 3M93+NV+j2ovrxrgbM7W0Kdp5+SD2aM/0QSYKO15oh1I7Cxeix0TdmeyWIgJH69RhzFv iWpmzVfl4proFyEUZSzkZ58QGncqeC3FNDMJ/zH46zJqEEEMY0BjeMedNse8BLJPwRcp 2Uxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=A9W2sZCF9TsA92jrnmPwe+qydShQXcLUoRlpZNsydLs=; b=qdwve7GpB5osmHSEsEbmZ/hNRB0+8BvJvcyYl0WUVOkvsoDNuaUDwPvH9ddDhS+xxY RTk2HEbmGlHbmPN+6dZrPQ59lqSyOPmXetZYpiju6TiAFl/tr4h/f6EYgmtsAV+TK/cF NdjOOblZMdWGhAGnzKPCJM7FMynSj9k1BjtTH41bN9hBRixHChCGDu8O76x0dCHUzhFa NlsxYfUWjQPVYAAmFGzMojD5tjvEOcJsVIVqX0Mx/IM19KzeKVHvwzMW/0oDKYuiygMj 24SkNMz0GsxSpePYPY6VhUoCRjesg+fX+m8m21bv02IPG6826au7gVvO4BFcNb6ivrSW /NIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hY9qBsqe; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a139si10760311ybg.75.2022.01.22.10.28.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 22 Jan 2022 10:28:46 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hY9qBsqe; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nBL81-0006gv-Mf for patch@linaro.org; Sat, 22 Jan 2022 13:28:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34392) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nBL4o-0005jz-VK for qemu-devel@nongnu.org; Sat, 22 Jan 2022 13:25:29 -0500 Received: from [2a00:1450:4864:20::433] (port=35723 helo=mail-wr1-x433.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nBL4V-0007hP-Ap for qemu-devel@nongnu.org; Sat, 22 Jan 2022 13:25:10 -0500 Received: by mail-wr1-x433.google.com with SMTP id r14so5908929wrp.2 for ; Sat, 22 Jan 2022 10:24:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=A9W2sZCF9TsA92jrnmPwe+qydShQXcLUoRlpZNsydLs=; b=hY9qBsqe5YW6mXtX8cv2chdwQrP/T27eaRN2GA+0H0NFbezHCuoMHcBbmEg/ggFIm3 apsTcKZPhWoC9Yx6h2tvc2SNzasDPjfDbPTS1rmARjqo2dmIcmyUdQ30O05+mmbixrvw 4/pvmcxdY8P+IjiJq2eFD7BfDyRIe3vOpjsHo8x4C9hQ707OnrNgTpQ7y8OFcVybtaYk OoiW3m/65A62L6CfxOUVu/4QD4ysKfAW2LoVFn7dlOUY9u3rdCpRPUD9sIIuZAWh9MQG f6ABcPJGtURGVrFcg45tGUhA3VMg6fzcg9LOlw9qPPLcpC977LGw/Qw6oPdNG47R/fe5 MyPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=A9W2sZCF9TsA92jrnmPwe+qydShQXcLUoRlpZNsydLs=; b=Q46BxaQYQ8ENgJapl5fimBziZyC0hpxhZTnZYHWvNM+DZhthwczO+22rxVW4XH6uQ3 cVqKQlCXZMKxMvKh5mlE2ZhSElRuhMHRryq+ErgC0srZvsvJr/51pMiWK7bz6atzjzuO BuEPDxqg1C7zElZ9cbPyyKP2dO+6MXWFr8s6MT1BPsjLZdekLwo5zjnwdrVbYVkgme9M mIdVXcDeMp6LV7AT6IE9E7I5KbiitJVOh8JtGSLIby5fPx7xNw32w443Mr0cZ+XoCgl7 50i+6QpG5BFt37SY4169Yxp68Cdg6MYKuwQDyn2C8JxATMRGEgYTwMoCzW5YhblVZHJN ZA+w== X-Gm-Message-State: AOAM533V/c+zMdofyRte6ZBzgQq8Vqr7L8mbJ4oDW9AMVC2IOMfrxAvc NnpWfZxefc3qc0xDZC03p5Ljrb6UhsJN4A== X-Received: by 2002:adf:f7c8:: with SMTP id a8mr8433490wrq.603.1642875893344; Sat, 22 Jan 2022 10:24:53 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 21sm8870774wmk.45.2022.01.22.10.24.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Jan 2022 10:24:52 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 10/14] hw/intc/arm_gicv3_its: Provide read accessor for translation_ops Date: Sat, 22 Jan 2022 18:24:40 +0000 Message-Id: <20220122182444.724087-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220122182444.724087-1-peter.maydell@linaro.org> References: <20220122182444.724087-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::433 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shashi Mallela , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The MemoryRegionOps gicv3_its_translation_ops currently provides only a .write_with_attrs function, because the only register in this region is the write-only GITS_TRANSLATER. However, if you don't provide a read function and the guest tries reading from this memory region, QEMU will crash because memory_region_read_with_attrs_accessor() calls a NULL pointer. Add a read function which always returns 0, to cover both bogus attempts to read GITS_TRANSLATER and also reads from the rest of the region, which is documented to be reserved, RES0. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/intc/arm_gicv3_its.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index d9ff7b88492..b17f2631269 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -813,6 +813,18 @@ static void extract_cmdq_params(GICv3ITSState *s) } } +static MemTxResult gicv3_its_translation_read(void *opaque, hwaddr offset, + uint64_t *data, unsigned size, + MemTxAttrs attrs) +{ + /* + * GITS_TRANSLATER is write-only, and all other addresses + * in the interrupt translation space frame are RES0. + */ + *data = 0; + return MEMTX_OK; +} + static MemTxResult gicv3_its_translation_write(void *opaque, hwaddr offset, uint64_t data, unsigned size, MemTxAttrs attrs) @@ -1168,6 +1180,7 @@ static const MemoryRegionOps gicv3_its_control_ops = { }; static const MemoryRegionOps gicv3_its_translation_ops = { + .read_with_attrs = gicv3_its_translation_read, .write_with_attrs = gicv3_its_translation_write, .valid.min_access_size = 2, .valid.max_access_size = 4,