From patchwork Mon May 8 09:06:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharata B Rao X-Patchwork-Id: 759579 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wLyQg2wYNz9s5L for ; Mon, 8 May 2017 19:49:47 +1000 (AEST) Received: from localhost ([::1]:58554 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d7fIW-00050u-SE for incoming@patchwork.ozlabs.org; Mon, 08 May 2017 05:49:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57510) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d7fHR-0004eQ-CM for qemu-devel@nongnu.org; Mon, 08 May 2017 05:48:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d7fHM-00089z-EQ for qemu-devel@nongnu.org; Mon, 08 May 2017 05:48:37 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:33048 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d7fHM-00089U-8Q for qemu-devel@nongnu.org; Mon, 08 May 2017 05:48:32 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v489YD9M046468 for ; Mon, 8 May 2017 05:48:30 -0400 Received: from e23smtp05.au.ibm.com (e23smtp05.au.ibm.com [202.81.31.147]) by mx0a-001b2d01.pphosted.com with ESMTP id 2aamkwwntj-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 08 May 2017 05:48:30 -0400 Received: from localhost by e23smtp05.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 8 May 2017 19:09:46 +1000 Received: from d23relay08.au.ibm.com (202.81.31.227) by e23smtp05.au.ibm.com (202.81.31.211) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 8 May 2017 19:08:20 +1000 Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay08.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v4897F7425493508; Mon, 8 May 2017 19:07:23 +1000 Received: from d23av02.au.ibm.com (localhost [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v4896iUR020276; Mon, 8 May 2017 19:06:45 +1000 Received: from bharata.in.ibm.com ([9.124.35.48]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v4896faU019428; Mon, 8 May 2017 19:06:43 +1000 From: Bharata B Rao To: qemu-devel@nongnu.org Date: Mon, 8 May 2017 14:36:16 +0530 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1494234377-1773-1-git-send-email-bharata@linux.vnet.ibm.com> References: <1494234377-1773-1-git-send-email-bharata@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17050809-0016-0000-0000-0000023A0DC9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17050809-0017-0000-0000-000006B70D16 Message-Id: <1494234377-1773-2-git-send-email-bharata@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-08_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=3 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705080056 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [RFC PATCH 1/2] spapr: Make h_register_process_table hcall flags global 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: rnsastry@linux.vnet.ibm.com, qemu-ppc@nongnu.org, Bharata B Rao , sam.bobroff@au1.ibm.com, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The flags used in h_register_process_table hcall are needed in spapr.c and hence move them to a header file. While doing so, give them slightly specific names. Signed-off-by: Bharata B Rao Reviewed-by: David Gibson --- hw/ppc/spapr_hcall.c | 31 ++++++++++++++----------------- include/hw/ppc/spapr.h | 10 ++++++++++ 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 0d608d6..3600b0e 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -924,13 +924,6 @@ static void spapr_check_setup_free_hpt(sPAPRMachineState *spapr, return; } -#define FLAGS_MASK 0x01FULL -#define FLAG_MODIFY 0x10 -#define FLAG_REGISTER 0x08 -#define FLAG_RADIX 0x04 -#define FLAG_HASH_PROC_TBL 0x02 -#define FLAG_GTSE 0x01 - static target_ulong h_register_process_table(PowerPCCPU *cpu, sPAPRMachineState *spapr, target_ulong opcode, @@ -943,12 +936,13 @@ static target_ulong h_register_process_table(PowerPCCPU *cpu, target_ulong table_size = args[3]; uint64_t cproc; - if (flags & ~FLAGS_MASK) { /* Check no reserved bits are set */ + if (flags & ~SPAPR_PROC_TABLE_MASK) { /* Check no reserved bits are set */ return H_PARAMETER; } - if (flags & FLAG_MODIFY) { - if (flags & FLAG_REGISTER) { - if (flags & FLAG_RADIX) { /* Register new RADIX process table */ + if (flags & SPAPR_PROC_TABLE_MODIFY) { + if (flags & SPAPR_PROC_TABLE_REGISTER) { + if (flags & SPAPR_PROC_TABLE_RADIX) { + /* Register new RADIX process table */ if (proc_tbl & 0xfff || proc_tbl >> 60) { return H_P2; } else if (page_size) { @@ -958,7 +952,8 @@ static target_ulong h_register_process_table(PowerPCCPU *cpu, } cproc = PATBE1_GR | proc_tbl | table_size; } else { /* Register new HPT process table */ - if (flags & FLAG_HASH_PROC_TBL) { /* Hash with Segment Tables */ + if (flags & SPAPR_PROC_TABLE_HPT_PT) { + /* Hash with Segment Tables */ /* TODO - Not Supported */ /* Technically caused by flag bits => H_PARAMETER */ return H_PARAMETER; @@ -981,7 +976,8 @@ static target_ulong h_register_process_table(PowerPCCPU *cpu, cproc = spapr->patb_entry & PATBE1_GR; } } else { /* Maintain current registration */ - if (!(flags & FLAG_RADIX) != !(spapr->patb_entry & PATBE1_GR)) { + if (!(flags & SPAPR_PROC_TABLE_RADIX) != + !(spapr->patb_entry & PATBE1_GR)) { /* Technically caused by flag bits => H_PARAMETER */ return H_PARAMETER; /* Existing Process Table Mismatch */ } @@ -996,13 +992,14 @@ static target_ulong h_register_process_table(PowerPCCPU *cpu, /* Update the UPRT and GTSE bits in the LPCR for all cpus */ CPU_FOREACH(cs) { set_spr(cs, SPR_LPCR, LPCR_UPRT | LPCR_GTSE, - ((flags & (FLAG_RADIX | FLAG_HASH_PROC_TBL)) ? LPCR_UPRT : 0) | - ((flags & FLAG_GTSE) ? LPCR_GTSE : 0)); + ((flags & (SPAPR_PROC_TABLE_RADIX | SPAPR_PROC_TABLE_HPT_PT)) ? + LPCR_UPRT : 0) | ((flags & SPAPR_PROC_TABLE_GTSE) ? + SPAPR_PROC_TABLE_GTSE : 0)); } if (kvm_enabled()) { - return kvmppc_configure_v3_mmu(cpu, flags & FLAG_RADIX, - flags & FLAG_GTSE, cproc); + return kvmppc_configure_v3_mmu(cpu, flags & SPAPR_PROC_TABLE_RADIX, + flags & SPAPR_PROC_TABLE_GTSE, cproc); } return H_SUCCESS; } diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 5802f88..a692e63 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -681,4 +681,14 @@ int spapr_rng_populate_dt(void *fdt); void spapr_do_system_reset_on_cpu(CPUState *cs, run_on_cpu_data arg); +/* + * Defines for flag value used in H_REGISTER_PROC_TBL hcall. + */ +#define SPAPR_PROC_TABLE_MASK 0x01FULL +#define SPAPR_PROC_TABLE_MODIFY 0x10 +#define SPAPR_PROC_TABLE_REGISTER 0x08 +#define SPAPR_PROC_TABLE_RADIX 0x04 +#define SPAPR_PROC_TABLE_HPT_PT 0x02 +#define SPAPR_PROC_TABLE_GTSE 0x01 + #endif /* HW_SPAPR_H */