From patchwork Fri May 10 15:19:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 163882 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:142:0:0:0:0 with SMTP id j2csp2529062ilr; Fri, 10 May 2019 08:34:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGyg44g/CB9/cxagGe7X2wsLjTtJR+AULQgc875bAO3OisVvoLARZL7YLJokddcANrXpHQ X-Received: by 2002:a17:906:fccb:: with SMTP id qx11mr9181620ejb.276.1557502489790; Fri, 10 May 2019 08:34:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557502489; cv=none; d=google.com; s=arc-20160816; b=eUn2v2TVzYVewWILgTMK8rmh5YZrRj+pRqRd1SJ9VYy94FnKygcYzZ4A+UJycllcVY r74lZ1++ludYrmi3NZUppvmS+2eoFJSN0DyST89Wmyg7zTj4QPq0SfBg9Oho4ZN1r6Ug jKHZI6Fx3tCBi/ktrllfAHCvp/gLgkiztlDnUI61Cw6S76Pn/LjrRNAxZt2RkPB4ZBXG iNz6RFMyNoUAFWmJ5mLbOAnnJ3BmJ+UV/hQZ18EOo4OvTyRszTpg6+ORQga7ud0GwY+0 sdKypjkpvjctxz00OYFiAZxqUA0gMEhv5nUbyJ4yuy6hI0DE2QngpqcwX9Z8HK/+4U4i Ltnw== 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=LTrRBAzo3ZXhs7/OIQshe/0vUKzYgpD3ylIgF8SzGa8=; b=A6TASyjqTa6cDipYhA/4PWxftdICtwbIf/TYs95KBFe2TMQzsEQtqP1WtfkVcuonLS tdbRwbFxEL/KhNp2pw0YKvWzU0wVps34oRcdrhupwmFJqAD0MXYyJkw4rJ8oTst+pFLD CQXRXBH7GF2Ym2gVNvP3G4t0apmFTPgVX3uf2bMeqqPBVESHppJJAZ0LOgsfDpeKEOVq HyqBETgtrA0hWGMydPoaWCxQdEMpMrxVIqPYAB3uBFgiP/hfTkaNM7WMfAyHrwTPfOst 7BQPXwFzUqrnDmGwAN/wkylNefwZ398AN1EIcGfFLrfGUv9mz3D5KXHbk9YAG+50LM/m 9Wtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=HvtWRwwV; 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 a57si1660367eda.447.2019.05.10.08.34.49 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 10 May 2019 08:34:49 -0700 (PDT) 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=HvtWRwwV; 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]:45178 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP7Xs-0004XK-Kc for patch@linaro.org; Fri, 10 May 2019 11:34:48 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP7Jq-0007rH-1l for qemu-devel@nongnu.org; Fri, 10 May 2019 11:20:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hP7Jo-0000Hb-Kl for qemu-devel@nongnu.org; Fri, 10 May 2019 11:20:18 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:34226) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hP7Jo-0000Gh-Ea for qemu-devel@nongnu.org; Fri, 10 May 2019 11:20:16 -0400 Received: by mail-pl1-x642.google.com with SMTP id w7so3006367plz.1 for ; Fri, 10 May 2019 08:20:16 -0700 (PDT) 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=LTrRBAzo3ZXhs7/OIQshe/0vUKzYgpD3ylIgF8SzGa8=; b=HvtWRwwVB1w9aF10ma3266UkhJwugJ2Xe237/AcUu98AJ0mWShJrnsyeNI9Lc/r5UO GVNbtYnI8EWn/nGjON+9NWJI6CXQSLNpAU6ne+9LYILoXin9r7d5eVSN6efyl8xN2ybU 8Ca09Y6WpgB0ALaztAQ8dt2X2OQH2oywhjmAUHFh2VLzTd6c+Xzx/GZwL7oZ3C8Fk3d3 jKF5UKibHLqKbs8L3NK8BijGdCsU39ZGH5e60WZ5bKWLZD1wvPADmiCwxe+ZNsIQXDMx 71EyIl1BJj9dkDjk6BJCLtlOdanGzRxAb2GpEMycn86abCne7kQUerf9KxVQlDUSBXBI K21g== 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=LTrRBAzo3ZXhs7/OIQshe/0vUKzYgpD3ylIgF8SzGa8=; b=P2TWrznBmPY89/XJny//j0AInD7KKTygESgbyZcjwKdnFFkUMidxw9iRaD6Zrqnv0C VVxKm2/cU7anmTr0pT4NnOkOGOVqBblKABnWGpZ0plDg9rOe92v7HRRwmpjjnLBEKZeT JN8IdTocQOxdbtKBOAxwdYm1BSDTUPc0L5J87BssS3sAwjEcEjjzIK2ihBUbIiuyQFq9 tK/aKzJYZ8uCuEL8sjffQXs9Fv9gMZ1frsJ0wo2AGMCe9+AdpeeiAvyyNjhsS15/1UTi H02dS1VjoHgBwLL+x1zNPNaEcHrirgXBs9/9deqzCUog6PRbSUv8wfA9C6mzZYVRRz1R j2vQ== X-Gm-Message-State: APjAAAVDN4r8GeNQqKpczgchaHAv/y0OAz2NqUKz0lupkbNlujGtMhHG uPMaomuEEmNKOwKIYN5CBtRdSfT0vl0= X-Received: by 2002:a17:902:9a08:: with SMTP id v8mr13552234plp.105.1557501615201; Fri, 10 May 2019 08:20:15 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id 19sm5920517pgz.24.2019.05.10.08.20.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 May 2019 08:20:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 10 May 2019 08:19:40 -0700 Message-Id: <20190510151944.22981-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190510151944.22981-1-richard.henderson@linaro.org> References: <20190510151944.22981-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::642 Subject: [Qemu-devel] [PULL 23/27] target/unicore32: Convert to CPUClass::tlb_fill 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, Guan Xuetao Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Remove the user-only functions, as we no longer have a user-only config. Cc: Guan Xuetao Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/unicore32/cpu.h | 5 +++-- target/unicore32/cpu.c | 5 +---- target/unicore32/helper.c | 23 ----------------------- target/unicore32/op_helper.c | 14 -------------- target/unicore32/softmmu.c | 19 +++++++++++++++---- 5 files changed, 19 insertions(+), 47 deletions(-) -- 2.17.1 diff --git a/target/unicore32/cpu.h b/target/unicore32/cpu.h index 24abe5e5c0..f052ee08bf 100644 --- a/target/unicore32/cpu.h +++ b/target/unicore32/cpu.h @@ -178,8 +178,9 @@ static inline void cpu_get_tb_cpu_state(CPUUniCore32State *env, target_ulong *pc } } -int uc32_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int size, int rw, - int mmu_idx); +bool uc32_cpu_tlb_fill(CPUState *cs, vaddr address, int size, + MMUAccessType access_type, int mmu_idx, + bool probe, uintptr_t retaddr); void uc32_translate_init(void); void switch_mode(CPUUniCore32State *, int); diff --git a/target/unicore32/cpu.c b/target/unicore32/cpu.c index 2b49d1ca40..3f57c508a0 100644 --- a/target/unicore32/cpu.c +++ b/target/unicore32/cpu.c @@ -138,11 +138,8 @@ static void uc32_cpu_class_init(ObjectClass *oc, void *data) cc->cpu_exec_interrupt = uc32_cpu_exec_interrupt; cc->dump_state = uc32_cpu_dump_state; cc->set_pc = uc32_cpu_set_pc; -#ifdef CONFIG_USER_ONLY - cc->handle_mmu_fault = uc32_cpu_handle_mmu_fault; -#else + cc->tlb_fill = uc32_cpu_tlb_fill; cc->get_phys_page_debug = uc32_cpu_get_phys_page_debug; -#endif cc->tcg_initialize = uc32_translate_init; dc->vmsd = &vmstate_uc32_cpu; } diff --git a/target/unicore32/helper.c b/target/unicore32/helper.c index a5ff2ddb74..0d4914b48d 100644 --- a/target/unicore32/helper.c +++ b/target/unicore32/helper.c @@ -215,29 +215,6 @@ void helper_cp1_putc(target_ulong x) } #endif -#ifdef CONFIG_USER_ONLY -void switch_mode(CPUUniCore32State *env, int mode) -{ - UniCore32CPU *cpu = uc32_env_get_cpu(env); - - if (mode != ASR_MODE_USER) { - cpu_abort(CPU(cpu), "Tried to switch out of user mode\n"); - } -} - -void uc32_cpu_do_interrupt(CPUState *cs) -{ - cpu_abort(cs, "NO interrupt in user mode\n"); -} - -int uc32_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, - int access_type, int mmu_idx) -{ - cpu_abort(cs, "NO mmu fault in user mode\n"); - return 1; -} -#endif - bool uc32_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { if (interrupt_request & CPU_INTERRUPT_HARD) { diff --git a/target/unicore32/op_helper.c b/target/unicore32/op_helper.c index e0a15882d3..797ba60dc9 100644 --- a/target/unicore32/op_helper.c +++ b/target/unicore32/op_helper.c @@ -242,17 +242,3 @@ uint32_t HELPER(ror_cc)(CPUUniCore32State *env, uint32_t x, uint32_t i) return ((uint32_t)x >> shift) | (x << (32 - shift)); } } - -#ifndef CONFIG_USER_ONLY -void tlb_fill(CPUState *cs, target_ulong addr, int size, - MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) -{ - int ret; - - ret = uc32_cpu_handle_mmu_fault(cs, addr, size, access_type, mmu_idx); - if (unlikely(ret)) { - /* now we have a real cpu fault */ - cpu_loop_exit_restore(cs, retaddr); - } -} -#endif diff --git a/target/unicore32/softmmu.c b/target/unicore32/softmmu.c index 00c7e0d028..13678df4d7 100644 --- a/target/unicore32/softmmu.c +++ b/target/unicore32/softmmu.c @@ -215,8 +215,9 @@ do_fault: return code; } -int uc32_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, - int access_type, int mmu_idx) +bool uc32_cpu_tlb_fill(CPUState *cs, vaddr address, int size, + MMUAccessType access_type, int mmu_idx, + bool probe, uintptr_t retaddr) { UniCore32CPU *cpu = UNICORE32_CPU(cs); CPUUniCore32State *env = &cpu->env; @@ -257,7 +258,11 @@ int uc32_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, phys_addr &= TARGET_PAGE_MASK; address &= TARGET_PAGE_MASK; tlb_set_page(cs, address, phys_addr, prot, mmu_idx, page_size); - return 0; + return true; + } + + if (probe) { + return false; } env->cp0.c3_faultstatus = ret; @@ -267,7 +272,13 @@ int uc32_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, } else { cs->exception_index = UC32_EXCP_DTRAP; } - return ret; + cpu_loop_exit_restore(cs, retaddr); +} + +void tlb_fill(CPUState *cs, target_ulong addr, int size, + MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) +{ + uc32_cpu_tlb_fill(cs, addr, size, access_type, mmu_idx, false, retaddr); } hwaddr uc32_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)