From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 507961118B; Mon, 11 Mar 2024 05:39:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710135572; cv=none; b=d3N2ttZliWV+45+4xpI5JWIGGx/ycd/HcvEiGfAkol/ORwtvJl0hI8f5G9iB04tifSU5zVCHLbLPw8AXqBDRo34ShGEX5/ZwWnIIUSkhaceiPe+NnarrJPgXYPFzAhdJ5jP7QOCSohTzsj0A69QXR7uFOd+2S4g1h4KvWBSzxHw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710135572; c=relaxed/simple; bh=Ka56Z2TcjSC1k5aIslx4wiCYsvuC+7+F9E44sweIR+I=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ChoDw6seYju4CmMTdx+blePUa9epCi5dThZTCqGsTYFrkBA0dhJptD5o68Af/DoZ5SM0uukZzU8pbcYWhc2jZxMWBBkh8s+/oOkljVePhfv61WPZc84WZ//aESwMZUTut6jnmYunvE97DvQ71u+1u+VPfd2fTXvWUB9Lxl2pomc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=fEAv3/aM; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="fEAv3/aM" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42B4SW71008209; Mon, 11 Mar 2024 05:39:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= date:from:to:cc:subject:message-id:reply-to:references :mime-version:content-type:in-reply-to; s=qcppdkim1; bh=LmmM6Mle Qg7vLFazyHImNbnBaOz3grFitf91olyQU6M=; b=fEAv3/aMWYtirJq0zXcH6ajx /kugt7oM1cJHlSZFFqb+0tdx3T97wpaXwBbUanXlVd0IgS+grYfEk0Hg+Ky1EHMQ xVWUXnVhXHf+L3uhiYPhxJBVy1fqIhoiqiXJlkZiFD4zGrjCOWFVRtRjTCawtama RaAWyPiyvaGQ0OfbRI4qPMSPg2KVvb2dxYhqEWhK4vyhUzWcOI7ykwqjF5AyfjHe dm007Y6/PMTGVyj903ZYKssWWn3uFOXJ3U7wh91WrOCBW4YyramNz7olKy3cSUUI O0pA+duiisZo+Y4ErjTAoSS7bU0CcLbeZvQc61KEhfYuFiptnRyJd/oOUREaUg== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wss1gr81p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Mar 2024 05:39:17 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 42B5dG9l024078 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Mar 2024 05:39:16 GMT Received: from quicinc.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Sun, 10 Mar 2024 22:39:08 -0700 Date: Mon, 11 Mar 2024 11:09:05 +0530 From: Srivatsa Vaddagiri To: Elliot Berman CC: Alex Elder , Srinivas Kandagatla , Murali Nalajal , Trilok Soni , Carl van Schaik , Philip Derrin , Prakruthi Deepak Heragu , Jonathan Corbet , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Catalin Marinas , Will Deacon , Konrad Dybcio , Bjorn Andersson , Dmitry Baryshkov , "Fuad Tabba" , Sean Christopherson , "Andrew Morton" , , , , , , Subject: Re: [PATCH v17 11/35] virt: gunyah: Translate gh_rm_hyp_resource into gunyah_resource Message-ID: <20240311053905.GN440762@quicinc.com> Reply-To: Srivatsa Vaddagiri References: <20240222-gunyah-v17-0-1e9da6763d38@quicinc.com> <20240222-gunyah-v17-11-1e9da6763d38@quicinc.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline In-Reply-To: <20240222-gunyah-v17-11-1e9da6763d38@quicinc.com> X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: V2xhelRylHxeRMVsunfbTeMlRPUvSRSA X-Proofpoint-GUID: V2xhelRylHxeRMVsunfbTeMlRPUvSRSA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-11_02,2024-03-06_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 impostorscore=0 priorityscore=1501 spamscore=0 suspectscore=0 adultscore=0 mlxlogscore=559 phishscore=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2403110041 * Elliot Berman [2024-02-22 15:16:34]: > When booting a Gunyah virtual machine, the host VM may gain capabilities > to interact with resources for the guest virtual machine. Examples of > such resources are vCPUs or message queues. To use those resources, we > need to translate the RM response into a gunyah_resource structure which > are useful to Linux drivers. Presently, Linux drivers need only to know > the type of resource, the capability ID, and an interrupt. > > On ARM64 systems, the interrupt reported by Gunyah is the GIC interrupt > ID number and always a SPI or extended SPI. > > Signed-off-by: Elliot Berman Minor nit below. LGTM otherwise Reviewed-by: Srivatsa Vaddagiri > +struct gunyah_resource * > +gunyah_rm_alloc_resource(struct gunyah_rm *rm, > + struct gunyah_rm_hyp_resource *hyp_resource) > +{ > + struct gunyah_resource *ghrsc; > + int ret; > + > + ghrsc = kzalloc(sizeof(*ghrsc), GFP_KERNEL); > + if (!ghrsc) > + return NULL; > + > + ghrsc->type = hyp_resource->type; > + ghrsc->capid = le64_to_cpu(hyp_resource->cap_id); > + ghrsc->irq = IRQ_NOTCONNECTED; > + ghrsc->rm_label = le32_to_cpu(hyp_resource->resource_label); > + if (hyp_resource->virq) { > + struct irq_fwspec fwspec; > + > + > + fwspec.fwnode = rm->parent_fwnode; > + ret = arch_gunyah_fill_irq_fwspec_params(le32_to_cpu(hyp_resource->virq), &fwspec); > + if (ret) { > + dev_err(rm->dev, > + "Failed to translate interrupt for resource %d label: %d: %d\n", > + ghrsc->type, ghrsc->rm_label, ret); Not bailing on error here appears wrong. Can you check? > + } > + > + ret = irq_create_fwspec_mapping(&fwspec); > + if (ret < 0) { > + dev_err(rm->dev, > + "Failed to allocate interrupt for resource %d label: %d: %d\n", > + ghrsc->type, ghrsc->rm_label, ret); > + kfree(ghrsc); > + return NULL; > + } > + ghrsc->irq = ret; > + } > + > + return ghrsc; > +} From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1FA26C54E58 for ; Mon, 11 Mar 2024 05:39:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version: References:Message-ID:Subject:CC:To:From:Date:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=u9jBkjL+AI9tgz13R7/oFzgQnZ7JAXyS2KHqbpa1Evs=; b=jUrsY2d9+gxTgI vgHxX+eOJVx0xjhIAVO2CBffj+HuZJpEvsayQJF76qstsasAnlRAUzNXXMBgN1u+aAFsOEWJFwg7q IG0Zp8m+SKjoYzZiNLPKoRX6WNf/B5Wom1pbzyh5LGCd6rBiDlbpw/by5zsXTizW3QLPNw5YZpQNw iYoHPOlVF8NVRxXnleBXG+R0EYnFpqNWkphKUPtkFnmp7tr4A+oMDUbmupFpr0jGjsCQP6y+cDfCW BPQZUhRUY2q1vpBFjVqZBziReyNEtXmRVwu+dzQlJu8kL9MSr9YjFvR9iqtUnba75nuIPh8Lkjina 033imewCVBYlDtFV0arg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rjYNn-00000000HAK-0dyK; Mon, 11 Mar 2024 05:39:31 +0000 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rjYNj-00000000H7N-1E4U for linux-arm-kernel@lists.infradead.org; Mon, 11 Mar 2024 05:39:29 +0000 Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42B4SW71008209; Mon, 11 Mar 2024 05:39:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= date:from:to:cc:subject:message-id:reply-to:references :mime-version:content-type:in-reply-to; s=qcppdkim1; bh=LmmM6Mle Qg7vLFazyHImNbnBaOz3grFitf91olyQU6M=; b=fEAv3/aMWYtirJq0zXcH6ajx /kugt7oM1cJHlSZFFqb+0tdx3T97wpaXwBbUanXlVd0IgS+grYfEk0Hg+Ky1EHMQ xVWUXnVhXHf+L3uhiYPhxJBVy1fqIhoiqiXJlkZiFD4zGrjCOWFVRtRjTCawtama RaAWyPiyvaGQ0OfbRI4qPMSPg2KVvb2dxYhqEWhK4vyhUzWcOI7ykwqjF5AyfjHe dm007Y6/PMTGVyj903ZYKssWWn3uFOXJ3U7wh91WrOCBW4YyramNz7olKy3cSUUI O0pA+duiisZo+Y4ErjTAoSS7bU0CcLbeZvQc61KEhfYuFiptnRyJd/oOUREaUg== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wss1gr81p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Mar 2024 05:39:17 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 42B5dG9l024078 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Mar 2024 05:39:16 GMT Received: from quicinc.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Sun, 10 Mar 2024 22:39:08 -0700 Date: Mon, 11 Mar 2024 11:09:05 +0530 From: Srivatsa Vaddagiri To: Elliot Berman CC: Alex Elder , Srinivas Kandagatla , Murali Nalajal , Trilok Soni , Carl van Schaik , Philip Derrin , Prakruthi Deepak Heragu , Jonathan Corbet , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Catalin Marinas , Will Deacon , Konrad Dybcio , Bjorn Andersson , Dmitry Baryshkov , "Fuad Tabba" , Sean Christopherson , "Andrew Morton" , , , , , , Subject: Re: [PATCH v17 11/35] virt: gunyah: Translate gh_rm_hyp_resource into gunyah_resource Message-ID: <20240311053905.GN440762@quicinc.com> References: <20240222-gunyah-v17-0-1e9da6763d38@quicinc.com> <20240222-gunyah-v17-11-1e9da6763d38@quicinc.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240222-gunyah-v17-11-1e9da6763d38@quicinc.com> X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: V2xhelRylHxeRMVsunfbTeMlRPUvSRSA X-Proofpoint-GUID: V2xhelRylHxeRMVsunfbTeMlRPUvSRSA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-11_02,2024-03-06_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 impostorscore=0 priorityscore=1501 spamscore=0 suspectscore=0 adultscore=0 mlxlogscore=559 phishscore=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2403110041 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240310_223927_508961_0846F3CB X-CRM114-Status: GOOD ( 16.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Srivatsa Vaddagiri Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org * Elliot Berman [2024-02-22 15:16:34]: > When booting a Gunyah virtual machine, the host VM may gain capabilities > to interact with resources for the guest virtual machine. Examples of > such resources are vCPUs or message queues. To use those resources, we > need to translate the RM response into a gunyah_resource structure which > are useful to Linux drivers. Presently, Linux drivers need only to know > the type of resource, the capability ID, and an interrupt. > > On ARM64 systems, the interrupt reported by Gunyah is the GIC interrupt > ID number and always a SPI or extended SPI. > > Signed-off-by: Elliot Berman Minor nit below. LGTM otherwise Reviewed-by: Srivatsa Vaddagiri > +struct gunyah_resource * > +gunyah_rm_alloc_resource(struct gunyah_rm *rm, > + struct gunyah_rm_hyp_resource *hyp_resource) > +{ > + struct gunyah_resource *ghrsc; > + int ret; > + > + ghrsc = kzalloc(sizeof(*ghrsc), GFP_KERNEL); > + if (!ghrsc) > + return NULL; > + > + ghrsc->type = hyp_resource->type; > + ghrsc->capid = le64_to_cpu(hyp_resource->cap_id); > + ghrsc->irq = IRQ_NOTCONNECTED; > + ghrsc->rm_label = le32_to_cpu(hyp_resource->resource_label); > + if (hyp_resource->virq) { > + struct irq_fwspec fwspec; > + > + > + fwspec.fwnode = rm->parent_fwnode; > + ret = arch_gunyah_fill_irq_fwspec_params(le32_to_cpu(hyp_resource->virq), &fwspec); > + if (ret) { > + dev_err(rm->dev, > + "Failed to translate interrupt for resource %d label: %d: %d\n", > + ghrsc->type, ghrsc->rm_label, ret); Not bailing on error here appears wrong. Can you check? > + } > + > + ret = irq_create_fwspec_mapping(&fwspec); > + if (ret < 0) { > + dev_err(rm->dev, > + "Failed to allocate interrupt for resource %d label: %d: %d\n", > + ghrsc->type, ghrsc->rm_label, ret); > + kfree(ghrsc); > + return NULL; > + } > + ghrsc->irq = ret; > + } > + > + return ghrsc; > +} _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel