From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35812) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bG8k9-0000J1-2S for qemu-devel@nongnu.org; Thu, 23 Jun 2016 13:48:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bG8k6-0004eW-V1 for qemu-devel@nongnu.org; Thu, 23 Jun 2016 13:48:44 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:63862) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bG8k6-0004e9-LV for qemu-devel@nongnu.org; Thu, 23 Jun 2016 13:48:42 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u5NHi1sB123537 for ; Thu, 23 Jun 2016 13:48:42 -0400 Received: from e23smtp01.au.ibm.com (e23smtp01.au.ibm.com [202.81.31.143]) by mx0a-001b2d01.pphosted.com with ESMTP id 23q1qqgfk6-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 23 Jun 2016 13:48:41 -0400 Received: from localhost by e23smtp01.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 Jun 2016 03:48:39 +1000 From: Nikunj A Dadhania Date: Thu, 23 Jun 2016 23:17:22 +0530 In-Reply-To: <1466704050-15108-1-git-send-email-nikunj@linux.vnet.ibm.com> References: <1466704050-15108-1-git-send-email-nikunj@linux.vnet.ibm.com> Message-Id: <1466704050-15108-4-git-send-email-nikunj@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH v1 03/11] ppc/xics: Implement H_IPOLL using an accessor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Cc: qemu-devel@nongnu.org, clg@kaod.org, nikunj@linux.vnet.ibm.com, Benjamin Herrenschmidt From: Benjamin Herrenschmidt None of the other presenter functions directly mucks with the internal state, so don't do it there either. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Nikunj A Dadhania --- hw/intc/xics.c | 8 ++++++++ hw/intc/xics_spapr.c | 7 ++++--- include/hw/ppc/xics.h | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 6ca391f..40969ee 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -288,6 +288,14 @@ uint32_t icp_accept(ICPState *ss) return xirr; } +uint32_t icp_ipoll(ICPState *ss, uint32_t *mfrr) +{ + if (mfrr) { + *mfrr = ss->mfrr; + } + return ss->xirr; +} + void icp_eoi(XICSState *icp, int server, uint32_t xirr) { ICPState *ss = icp->ss + server; diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c index 48d458a..4d5adda 100644 --- a/hw/intc/xics_spapr.c +++ b/hw/intc/xics_spapr.c @@ -99,10 +99,11 @@ static target_ulong h_ipoll(PowerPCCPU *cpu, sPAPRMachineState *spapr, target_ulong opcode, target_ulong *args) { CPUState *cs = CPU(cpu); - ICPState *ss = &spapr->icp->ss[cs->cpu_index]; + uint32_t mfrr; + uint32_t xirr = icp_ipoll(spapr->icp->ss + cs->cpu_index, &mfrr); - args[0] = ss->xirr; - args[1] = ss->mfrr; + args[0] = xirr; + args[1] = mfrr; return H_SUCCESS; } diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 76b45ef..32ea706 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -186,6 +186,7 @@ int get_cpu_index_by_dt_id(int cpu_dt_id); void icp_set_cppr(XICSState *icp, int server, uint8_t cppr); void icp_set_mfrr(XICSState *icp, int server, uint8_t mfrr); uint32_t icp_accept(ICPState *ss); +uint32_t icp_ipoll(ICPState *ss, uint32_t *mfrr); void icp_eoi(XICSState *icp, int server, uint32_t xirr); void ics_write_xive(ICSState *ics, int nr, int server, -- 2.7.4