From patchwork Tue Jan 8 02:17:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 154955 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4357715jaa; Mon, 7 Jan 2019 18:20:08 -0800 (PST) X-Google-Smtp-Source: ALg8bN5BnNx20xB+0QNHsj6h2V6ZLjsRjiSjKnQeByEFGiZHscnMutG+ZNkFuTmsqFu6I//dt2iK X-Received: by 2002:adf:c452:: with SMTP id a18mr54629908wrg.145.1546914008114; Mon, 07 Jan 2019 18:20:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546914008; cv=none; d=google.com; s=arc-20160816; b=WFCt1To+IIbf4i2kOcoqWShFpJf/skj99Zz35M7XTwXtBA82Bw0KfSVSSA9m1WrOYE r4qxnqGJ+9+NPiz+GUT5gdtynidjfBzCOcHxIVO/fvRT+gHlcnFYr46DiEhXQbyxPu+c zxAYJMFaakDtKZ8Eo/qgyxw6b8uoY2L22STVZ4kghtnov59NF+kscX0K/4U4bDe3CX1L ycLvoLzC6KOILe7t08zXtmvCWFw3hA1wwAQ0a4dJRsBqm6uIo5kIR4iJXZ4Igao7smJu AWjjz7tVullrpAGn3LK1HjtIJJE0CbUhUv3KNGCK8BIef1NAIx5S02KiLxa5NxWahjxf 1uZQ== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=8yBr0Exh7UTFMeMWhRhfdOVF/dENufT9yCU4z4IZKHI=; b=Rc2FG7PuVvGm3+Mksuey52fTcbsIIIVEufQ7Wxv6jrKNMl3KLDUh2XQ8kN+KTEpezR /E/TRJ4JT64U4D30RjG/nO/x729KH/toQgIKCVenFr86rrBLvunPQZuwkR42nbzKcmbz P2Dptz6dgfBXT9AMk4aUA8rY9DcAJENxI4bLR8W6xPJIZEHblEId2cMKOUsVzk6VwEkX PjyDwJI7Sd+9U212/GRZMfJgu03//KLMYAxoqN9eTfEkQLOdPZgJDiGKS8ZrCEFaXF0q h1+1hIDWzr0M6FQeEQK+5EfJEaSJMN0BxJ8ZcNDoE/xaNf8sikSqQwFvBFWvBh7HVLsZ r5Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=T4vu0qxl; 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=fail (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 z187si5882681wmb.5.2019.01.07.18.20.07 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 07 Jan 2019 18:20:08 -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=fail header.i=@linaro.org header.s=google header.b=T4vu0qxl; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:49418 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gggzt-00009d-Uh for patch@linaro.org; Mon, 07 Jan 2019 21:20:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45614) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gggxV-0007g5-1c for qemu-devel@nongnu.org; Mon, 07 Jan 2019 21:17:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gggxT-0002Fo-NW for qemu-devel@nongnu.org; Mon, 07 Jan 2019 21:17:37 -0500 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:45492) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gggxR-0002C9-V7 for qemu-devel@nongnu.org; Mon, 07 Jan 2019 21:17:35 -0500 Received: by mail-pl1-x631.google.com with SMTP id a14so1065915plm.12 for ; Mon, 07 Jan 2019 18:17:33 -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; bh=8yBr0Exh7UTFMeMWhRhfdOVF/dENufT9yCU4z4IZKHI=; b=T4vu0qxlED6K2Bd+7K94JmiWOFEgdzbji5LuvifjQocW0F8r1JJqj5mGpQr5Lkc6p5 1aoeD1hEVUb8rUpLsMMRDFJEWTYyllgsofEdohKo2jYkY/FCUymrEqFyODYls7OaE75B vPgOlZzB87D2mQckB6TwDnz8xNtf+VAe44BD0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8yBr0Exh7UTFMeMWhRhfdOVF/dENufT9yCU4z4IZKHI=; b=DwPfyWdHgDMHQWTDJf9MTfi846zjBiETh9Je3dAwbk22xf7sScfLNugpzHhAWJtAxH kj3T5jwPme4Xn9HupwNVXwuJiWMJXcgg+bfJJtCA4HaBmBhOqAnrG9+/h4u0FPzv5FxO cAS8R7JZUOy+DY3MDUr3mLMM7r/X/jpep0pgFMaTsdBIyvLAbwxmsoc3IXRRZOiVlY7h R35KQLkaycpx2/rh9ZXFtcgVUO+9caaFXQ1eMxuF20vLPeGAMj5OIwdtpP+k9RJrENca FmmVg+8gHfy0djiAWp7q7rKaYz8olPVSx2DIqbjygbU5ZOQ38I+R2c1NgfaP9EuZS1v5 T/DA== X-Gm-Message-State: AJcUukcAauH34enszG2SYHJTthmq8I8O9yZ2zT8eRVCiaLYdIPo7iIsa NV8fcoag3bRNI7672BjMPFNyxNyVxH+MUw== X-Received: by 2002:a17:902:a98c:: with SMTP id bh12mr63999137plb.31.1546913852589; Mon, 07 Jan 2019 18:17:32 -0800 (PST) Received: from cloudburst.lan (2001-44b8-2176-c800-8cc6-2630-7d99-5ef1.static.ipv6.internode.on.net. [2001:44b8:2176:c800:8cc6:2630:7d99:5ef1]) by smtp.gmail.com with ESMTPSA id f64sm175814137pfh.0.2019.01.07.18.17.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Jan 2019 18:17:31 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 8 Jan 2019 12:17:21 +1000 Message-Id: <20190108021723.14762-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190108021723.14762-1-richard.henderson@linaro.org> References: <20190108021723.14762-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::631 Subject: [Qemu-devel] [PULL 1/3] hw/alpha/typhoon: Stop calling cpu_unassigned_access() 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell The typhoon MemoryRegionOps callbacks directly call cpu_unassigned_access(), presumably as the old-fashioned way to provoke a CPU exception. This won't work since commit 6ad4d7eed05a1e235 when we switched Alpha over to the transaction_failed hook API, because now cpu_unassigned_access() is a no-op for Alpha. Make the MemoryRegionOps callbacks use the read_with_attrs and write_with_attrs hooks, so they can signal a failure that should cause a CPU exception by returning MEMTX_ERROR. Signed-off-by: Peter Maydell Message-Id: <20181210173350.13073-1-peter.maydell@linaro.org> Tested-by: Richard Henderson Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson --- hw/alpha/typhoon.c | 47 ++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-) -- 2.17.2 diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c index 8004afe45b..cbacea5fbd 100644 --- a/hw/alpha/typhoon.c +++ b/hw/alpha/typhoon.c @@ -75,7 +75,9 @@ static void cpu_irq_change(AlphaCPU *cpu, uint64_t req) } } -static uint64_t cchip_read(void *opaque, hwaddr addr, unsigned size) +static MemTxResult cchip_read(void *opaque, hwaddr addr, + uint64_t *data, unsigned size, + MemTxAttrs attrs) { CPUState *cpu = current_cpu; TyphoonState *s = opaque; @@ -196,11 +198,11 @@ static uint64_t cchip_read(void *opaque, hwaddr addr, unsigned size) break; default: - cpu_unassigned_access(cpu, addr, false, false, 0, size); - return -1; + return MEMTX_ERROR; } - return ret; + *data = ret; + return MEMTX_OK; } static uint64_t dchip_read(void *opaque, hwaddr addr, unsigned size) @@ -209,7 +211,8 @@ static uint64_t dchip_read(void *opaque, hwaddr addr, unsigned size) return 0; } -static uint64_t pchip_read(void *opaque, hwaddr addr, unsigned size) +static MemTxResult pchip_read(void *opaque, hwaddr addr, uint64_t *data, + unsigned size, MemTxAttrs attrs) { TyphoonState *s = opaque; uint64_t ret = 0; @@ -294,15 +297,16 @@ static uint64_t pchip_read(void *opaque, hwaddr addr, unsigned size) break; default: - cpu_unassigned_access(current_cpu, addr, false, false, 0, size); - return -1; + return MEMTX_ERROR; } - return ret; + *data = ret; + return MEMTX_OK; } -static void cchip_write(void *opaque, hwaddr addr, - uint64_t val, unsigned size) +static MemTxResult cchip_write(void *opaque, hwaddr addr, + uint64_t val, unsigned size, + MemTxAttrs attrs) { TyphoonState *s = opaque; uint64_t oldval, newval; @@ -446,9 +450,10 @@ static void cchip_write(void *opaque, hwaddr addr, break; default: - cpu_unassigned_access(current_cpu, addr, true, false, 0, size); - return; + return MEMTX_ERROR; } + + return MEMTX_OK; } static void dchip_write(void *opaque, hwaddr addr, @@ -457,8 +462,9 @@ static void dchip_write(void *opaque, hwaddr addr, /* Skip this. It's all related to DRAM timing and setup. */ } -static void pchip_write(void *opaque, hwaddr addr, - uint64_t val, unsigned size) +static MemTxResult pchip_write(void *opaque, hwaddr addr, + uint64_t val, unsigned size, + MemTxAttrs attrs) { TyphoonState *s = opaque; uint64_t oldval; @@ -553,14 +559,15 @@ static void pchip_write(void *opaque, hwaddr addr, break; default: - cpu_unassigned_access(current_cpu, addr, true, false, 0, size); - return; + return MEMTX_ERROR; } + + return MEMTX_OK; } static const MemoryRegionOps cchip_ops = { - .read = cchip_read, - .write = cchip_write, + .read_with_attrs = cchip_read, + .write_with_attrs = cchip_write, .endianness = DEVICE_LITTLE_ENDIAN, .valid = { .min_access_size = 8, @@ -587,8 +594,8 @@ static const MemoryRegionOps dchip_ops = { }; static const MemoryRegionOps pchip_ops = { - .read = pchip_read, - .write = pchip_write, + .read_with_attrs = pchip_read, + .write_with_attrs = pchip_write, .endianness = DEVICE_LITTLE_ENDIAN, .valid = { .min_access_size = 8,