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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8D7FC54E58 for ; Mon, 11 Mar 2024 05:39:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3E55F6B0078; Mon, 11 Mar 2024 01:39:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 393C26B007B; Mon, 11 Mar 2024 01:39:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 234B86B007D; Mon, 11 Mar 2024 01:39:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 118C36B0078 for ; Mon, 11 Mar 2024 01:39:26 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id ADFF5A1185 for ; Mon, 11 Mar 2024 05:39:25 +0000 (UTC) X-FDA: 81883655490.30.EAE217F Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by imf23.hostedemail.com (Postfix) with ESMTP id A3CBC14000C for ; Mon, 11 Mar 2024 05:39:23 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b="fEAv3/aM"; dmarc=pass (policy=none) header.from=quicinc.com; spf=pass (imf23.hostedemail.com: domain of quic_svaddagi@quicinc.com designates 205.220.180.131 as permitted sender) smtp.mailfrom=quic_svaddagi@quicinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1710135563; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=LmmM6MleQg7vLFazyHImNbnBaOz3grFitf91olyQU6M=; b=uSI1B0MgKWYVE+QXHR0d+AF+YsbKThWCE8M86GZ/xfshKDP4tNsrbarrakDQOYJHnHj3dT ql6t/cS6SikClRmgtBBEqJywcK7NspVuPwM2J1SdO93moshBa5/J0wWhMWhSXPbRz7Pn+M Sbh4p952PUuSg3PZhi0W7E2ZIvlbzS0= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b="fEAv3/aM"; dmarc=pass (policy=none) header.from=quicinc.com; spf=pass (imf23.hostedemail.com: domain of quic_svaddagi@quicinc.com designates 205.220.180.131 as permitted sender) smtp.mailfrom=quic_svaddagi@quicinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710135563; a=rsa-sha256; cv=none; b=Blq7iRxXoerEBophwXcn0R8rAonC4SVDD+d8MTZ8f4ACc/ESVwmKgmcqF4qNJD0DbRw3x0 aM0b8DqU7NmAkWP6CK2VRZ3XDsC43xmVcnDVvrWvCISg3p0/1YjFLe11UqJioC4rpJImtH OtsPQzPWQW8yFixM4TZT4dVUQOtmrgM= 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> 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-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-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: A3CBC14000C X-Stat-Signature: mn7z83rcarmfgyyjhxqhztikmgfa8f7r X-HE-Tag: 1710135563-783232 X-HE-Meta: U2FsdGVkX1/MZw8nx4lvXBQQvdQCrrqiBA3XWThLoJZcCY5JOiP5rPlOtUwTYULeNmIGdoKTNae/3V5mzGOAtPc/1KO/7HUNolKUyYIM/2xlGCYiC51rusLLdzlX3wRFGDWBH343GsEU4JobFwCJEm2xiEtxUbDk1wJJHuEX3yrKbe1Ik1Wu6U6J3lWxfjRJMSuxJR+EfxE4OzqubvPXtB422S2pewaUcMDdUzY+Ygk8v9gDE1V2UWMJn2F2QncLw6gSx3pMfXSSnjNkF6m0IewSn7A3Slf7cL80DBU/KH8QkSR0TdBWZPb97JCIvLB23tjB4A00rctMmYEFsZIA1G3iqtxBeABSWs7ty8o6773p0pQL2JX+dKk9WdJMn5eTX0BudkBboUvIDc47dVU3yDZdWJd8z4V40N9xYFelYMKWZOH35SSOPzri6aB7Sxah6VvCtnr7xCmQHwUxjNQmp+G/VrKgxu9Y9ytiBevwpml08oQP/TjUKVtv/3D9iNgJTFgNVVFVoeDC/LhN9Kh1Y72ZVmeCpTglFJTfE6+ujBu0EyCTPmMZUV26EsBRYm74tvQOyLQMhAplFXLRUTh/7qUPrvdBftDpYrUXPstjnIdOPF/NbvPbhovHUFOCT/E3WRitI+e7bmq1QNi67Trj/EpR0BahroGgl+Ajj6PIX1Qj8kiuH0Cjp1lKwBu+YCMfuJCsmX73raUGofjEkpTLm9W51CzcFJtnFe05EF3b+eP1Bu/uackVvEkCzIueZBxjoSjrjE/9017jbU7hbZPS2iYiIbFedtnT0HLbi/sB7aoXUyehr/0OqkpL98nL4MW/T3Q9Dkn/vJzFRUhZ0AIlmJTb8LKLnTwO3wAR59EEdVLotuTtg8R7v/4bwR+zkstyIQHZvIeustkJIiOmQkkea3xG/Etkj+ZHdM5fiJjaoN+kkNOP9y3YvP14fr/axK3skchlnWT4sCphEC1q0km kcfqKiK4 g8M2EevBAPSm/iXmQjcUxymejUuaYPGP+8MVFBOY/JpXIejqIuoCsIR5y7TFB2/RH1nJXSYSTqm5jSlfC9Swa76HuXRYHRMlEh+mep9ArfH6iyrqa7v2cmJOEOzsjwHHt4Mma X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: * 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; > +}