From patchwork Sat Oct 1 10:05:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Artyom Tarasenko X-Patchwork-Id: 9359173 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EF181607D6 for ; Sat, 1 Oct 2016 10:37:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8828294A6 for ; Sat, 1 Oct 2016 10:37:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5D67295F9; Sat, 1 Oct 2016 10:37:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 48C2B294A6 for ; Sat, 1 Oct 2016 10:37:17 +0000 (UTC) Received: from localhost ([::1]:55087 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqHfQ-0006Jr-3Z for patchwork-qemu-devel@patchwork.kernel.org; Sat, 01 Oct 2016 06:37:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44149) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqHCa-0006Gq-79 for qemu-devel@nongnu.org; Sat, 01 Oct 2016 06:07:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bqHCY-0007j6-4R for qemu-devel@nongnu.org; Sat, 01 Oct 2016 06:07:27 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:35729) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqHCX-0007iw-TM for qemu-devel@nongnu.org; Sat, 01 Oct 2016 06:07:26 -0400 Received: by mail-wm0-x243.google.com with SMTP id f193so2153422wmg.2 for ; Sat, 01 Oct 2016 03:07:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3O2fjquQjHa2Nmief4/Nl0ol5UoRhEcMwsKkFpPLPIo=; b=jtor+1c2Ov72pjWANsfyhcEMoTskT/bzudp1FBJfunzmGQPh6xu3Qhuh3h3Zf39cMG LRBVYrB2dVLSm84eSMxiigLFgDY8fv0ZsHGIPHm4NlMJrq0sua+8OmUNNMPf2D37d/dL m36ifruKo0h+6VVEUNZhKiJIco34+5S6XjJ2FnUhUYZJiz5yi0wx38bd6LcPzcQ1vNhd ldvfaozCQtX7blw8n3sr7hRbjuI6kXC0nrm4caQGYugtdpAlD9e0j7ZF5EVZw5Q1Yg38 o5+wv72/U1pnowcB/gvAUicBzUlfmB6zTF8GMpGakUJT7WM7tqAkQ9P2oPdTDyyokYM3 qZ0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3O2fjquQjHa2Nmief4/Nl0ol5UoRhEcMwsKkFpPLPIo=; b=KVcljlhgSmp0aMooHrC4R977jHXlRs4TPgPOFmXPhkGh0RSdbbToPbuqHX5yMAFA7U 5U01KBPZWm/aMjoC4MA+zvR5kgPI+txPscNHlDX41NMVljvX9791qyeyoknCmK3nSKN5 F3D6uKeG3nSRW1ACHZPbVneOo4JYa6dNzyc1E9Ou84RmV1fzYDE7PWsocG9K3XuESMXA USarTjJqH5iQtVT6lJd6NXuXwFO4xR9yOvceE44qLttSPGF/7mwbNTiQlXIY/jEdPYtY xR5rZhaWGZYD4QTqxW43rGSk0V8C8eVk4FPKhUsdaHCDTgBL9l9l28/SpgOrXDqD7kQg GFeg== X-Gm-Message-State: AA6/9RkL5k9W2E43JTptMYORUNXAU+aJbz1zvNztWEYoFR++dX2obaPdDxM9u/JaFq9Rxg== X-Received: by 10.194.123.40 with SMTP id lx8mr11790353wjb.59.1475316445338; Sat, 01 Oct 2016 03:07:25 -0700 (PDT) Received: from localhost (x55b4da19.dyn.telefonica.de. [85.180.218.25]) by smtp.gmail.com with ESMTPSA id vh6sm23929731wjb.0.2016.10.01.03.07.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 01 Oct 2016 03:07:24 -0700 (PDT) From: Artyom Tarasenko To: qemu-devel@nongnu.org Date: Sat, 1 Oct 2016 12:05:18 +0200 Message-Id: <1475316333-9776-15-git-send-email-atar4qemu@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1475316333-9776-1-git-send-email-atar4qemu@gmail.com> References: <1475316333-9776-1-git-send-email-atar4qemu@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PATCH 14/29] target-sparc: use direct address translation in hyperprivileged mode 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: Mark Cave-Ayland , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Implement translation behavior described in the chapter 13.7 of "UltraSPARC T1™ Supplement to the UltraSPARC Architecture 2005". Please note that QEMU doesn't impelement Real->Physical address translation. The "Real Address" is always the "Physical Address". Signed-off-by: Artyom Tarasenko --- target-sparc/mmu_helper.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/target-sparc/mmu_helper.c b/target-sparc/mmu_helper.c index 32b629f..bef63f8 100644 --- a/target-sparc/mmu_helper.c +++ b/target-sparc/mmu_helper.c @@ -498,7 +498,8 @@ static int get_physical_address_data(CPUSPARCState *env, int is_user = (mmu_idx == MMU_USER_IDX || mmu_idx == MMU_USER_SECONDARY_IDX); - if ((env->lsu & DMMU_E) == 0) { /* DMMU disabled */ + if ((env->lsu & DMMU_E) == 0 || cpu_hypervisor_mode(env)) { + /* direct translation VA -> PA */ *physical = ultrasparc_truncate_physical(address); *prot = PAGE_READ | PAGE_WRITE; return 0; @@ -617,8 +618,9 @@ static int get_physical_address_code(CPUSPARCState *env, int is_user = (mmu_idx == MMU_USER_IDX || mmu_idx == MMU_USER_SECONDARY_IDX); - if ((env->lsu & IMMU_E) == 0 || (env->pstate & PS_RED) != 0) { - /* IMMU disabled */ + if (((env->lsu & IMMU_E) == 0) || (env->pstate & PS_RED) != 0 + || cpu_hypervisor_mode(env)) { + /* direct translation VA -> PA */ *physical = ultrasparc_truncate_physical(address); *prot = PAGE_EXEC; return 0;