From patchwork Mon Feb 18 14:32:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erlon Cruz X-Patchwork-Id: 221395 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 034B42C0092 for ; Tue, 19 Feb 2013 01:41:55 +1100 (EST) Received: from localhost ([::1]:54025 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7Rui-0000M6-Sl for incoming@patchwork.ozlabs.org; Mon, 18 Feb 2013 09:41:52 -0500 Received: from eggs.gnu.org ([208.118.235.92]:39365) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7RuB-0008G5-Ri for qemu-devel@nongnu.org; Mon, 18 Feb 2013 09:41:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U7RrT-0000m3-Un for qemu-devel@nongnu.org; Mon, 18 Feb 2013 09:38:43 -0500 Received: from mail-ye0-f173.google.com ([209.85.213.173]:44152) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7RrT-0000lq-P0; Mon, 18 Feb 2013 09:38:31 -0500 Received: by mail-ye0-f173.google.com with SMTP id l5so1026432yen.4 for ; Mon, 18 Feb 2013 06:38:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=F43JtuZe2UtavmOV+jpwAPOmSvD+q6xG/FJa44UES3s=; b=vBzom6czC0N1X3HXskGwky6gIUGw2fINh01dL324mVliuid3XHTieoXaRK2Sl0LFkb N0JZHBef56Wogcf6kI85Tzs1zB8mSO7PXpc5Wan6ZHxvkl/8xNCCL4jNy8Ts12INgFA+ 3dE1FaKnVh4DqtuZ4MDXYHn3ApJTOu0RJT6FV7UAgVYpikrElzwTZa8MVZug/y4Kn3/3 EKi7NAXkT5wZErKBs3S8Dl7nsfo6CqyPL6Ure1T4zVZp4vr8qtifEA317uJwWCiJxc5h XpnyJIWn6sWi7DY3KeyaL/TbEVSyApy2Mn1yjup7oOTk9adepP233R7rgUftnVaabfo+ pkZw== X-Received: by 10.236.180.232 with SMTP id j68mr21244765yhm.30.1361197957693; Mon, 18 Feb 2013 06:32:37 -0800 (PST) Received: from localhost.localdomain ([187.106.54.46]) by mx.google.com with ESMTPS id z20sm12423933anj.11.2013.02.18.06.32.35 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 18 Feb 2013 06:32:36 -0800 (PST) From: Erlon Cruz To: dwg@au1.ibm.com Date: Mon, 18 Feb 2013 11:32:21 -0300 Message-Id: <1361197941-18467-1-git-send-email-erlon.cruz@fit-tecnologia.org.br> X-Mailer: git-send-email 1.7.9.5 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.213.173 Cc: Erlon Cruz , brenohl@br.ibm.com, qemu-ppc@nongnu.org, agraf@suse.de, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] pseries: Implements h_read hcall X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Erlon Cruz This h_call is useful for DLPAR in future amongst other things. Given an index it fetches the corresponding PTE stored in the htab. Signed-off-by: Erlon Cruz --- hw/spapr_hcall.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/hw/spapr_hcall.c b/hw/spapr_hcall.c index 2889742..80ace25 100644 --- a/hw/spapr_hcall.c +++ b/hw/spapr_hcall.c @@ -323,6 +323,37 @@ static target_ulong h_protect(PowerPCCPU *cpu, sPAPREnvironment *spapr, return H_SUCCESS; } +static target_ulong h_read(PowerPCCPU *cpu, sPAPREnvironment *spapr, + target_ulong opcode, target_ulong *args) +{ + CPUPPCState *env = &cpu->env; + target_ulong flags = args[0]; + target_ulong pte_index = args[1]; + target_ulong v[4], r[4]; + uint8_t *hpte; + int i, ridx, n_entries = 1; + + if ((pte_index * HASH_PTE_SIZE_64) & ~env->htab_mask) { + return H_PARAMETER; + } + + if (flags & H_READ_4) { + /* Clear the two low order bits */ + pte_index &= ~(3ULL); + n_entries = 4; + } + + hpte = env->external_htab + (pte_index * HASH_PTE_SIZE_64); + + for (i = 0, ridx = 0; i < n_entries; i++) { + args[ridx++] = ldq_p(hpte); + args[ridx++] = ldq_p(hpte + (HASH_PTE_SIZE_64/2)); + hpte += HASH_PTE_SIZE_64; + } + + return H_SUCCESS; +} + static target_ulong h_set_dabr(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { @@ -714,6 +745,7 @@ static void hypercall_register_types(void) spapr_register_hypercall(H_ENTER, h_enter); spapr_register_hypercall(H_REMOVE, h_remove); spapr_register_hypercall(H_PROTECT, h_protect); + spapr_register_hypercall(H_READ, h_read); /* hcall-bulk */ spapr_register_hypercall(H_BULK_REMOVE, h_bulk_remove);