From nobody Wed Nov 27 06:53:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.vnet.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1700524406; cv=none; d=zohomail.com; s=zohoarc; b=Zp+rzcb2+IjhvVIxr2d5Jkt40tkWB0mY+3xqY6zynoYCeB9GN1ThcPM5wT5arveTl8bOSLBU1oua2Sn/dbWB7sKrtK6K+5VwhI+RZhoJJDHTZABGJ63G54Lrs27HoA/+RxTPpmiEuPZatfLBzPsYVHGgTC4ANLbfniMlbAsuJ1E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1700524406; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nqmvCI01+wMUnpNNmXuG46MS8cz+j21Pawj+Ww6qmfc=; b=fFC2PHOl1Tb858W7zCjVQv5q1ZTXqRwKTsbXKY7UYNttzoCQpodm7E7Akui0zvv+kof/6iEV7Mld/6Mofzt11Lf+Rm2SRGyQEa6pIelclp9EXtzcUdgRqUBXmFo05ga1ntPsj/iqLO43OvZA0/5FoStrgHziBfcdU72P37I03k4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1700524406375682.0968320122009; Mon, 20 Nov 2023 15:53:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r5E44-00076Q-Sf; Mon, 20 Nov 2023 18:52:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r5E41-000748-LT; Mon, 20 Nov 2023 18:52:25 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r5E3m-0001ka-5A; Mon, 20 Nov 2023 18:52:25 -0500 Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AKNVtYZ019890; Mon, 20 Nov 2023 23:52:05 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ugh7agavj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Nov 2023 23:52:05 +0000 Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AKNq4jP008892; Mon, 20 Nov 2023 23:52:04 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ugh7agav1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Nov 2023 23:52:04 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3AKNnETa007344; Mon, 20 Nov 2023 23:52:03 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([172.16.1.69]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uf8knmtyr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Nov 2023 23:52:03 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3AKNq2Ll6750808 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 20 Nov 2023 23:52:02 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7D24958061; Mon, 20 Nov 2023 23:52:02 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4A4DE5805E; Mon, 20 Nov 2023 23:52:02 +0000 (GMT) Received: from mamboa4.aus.stglabs.ibm.com (unknown [9.3.84.87]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 20 Nov 2023 23:52:02 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=nqmvCI01+wMUnpNNmXuG46MS8cz+j21Pawj+Ww6qmfc=; b=rSZxWtcOY1c034JUtdBPIYdbijH4Xs/uajVn5fNRpJgmV2EPRw+RKAVifzaDAck5w02+ Z7ZKaTijR7p5IXN6TZAduNTQye46L+FEcxBQH0tkm3rM5NDJ77c0/iMOI2ubG9uZHfZA ANS8icSWD5DqELDhvFKmAiwiVp6cICMzXNggpMEuFD8mldNHL9ZUgYbhC0yoACssOCdk mZJy/kIs7QOuxdhCg1FCrh0TBvkdrTf3LwbJ0TCflWJTXabvEhCL5+y2EpolFjElezXn K4sU+bm8wKNYgkM+/hvYoF/DeMzpFiRENJ9zLrSjj+IiB2Obw1W+P7OPIjtJGvI9RSS2 lg== From: Glenn Miles To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Glenn Miles , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Nicholas Piggin , =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Barrat?= Subject: [PATCH v4 04/11] ppc/pnv: Add pca9552 to powernv10-rainier for PCIe hotplug power control Date: Mon, 20 Nov 2023 17:51:05 -0600 Message-Id: <20231120235112.1951342-5-milesg@linux.vnet.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20231120235112.1951342-1-milesg@linux.vnet.ibm.com> References: <20231120235112.1951342-1-milesg@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: wpXqUFib-CoKJFSvjIf1uazuonw70Hh7 X-Proofpoint-ORIG-GUID: HlfVEmyCyZlR57B7vyr-bGX3XDlA6al2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-20_22,2023-11-20_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 adultscore=0 clxscore=1015 phishscore=0 mlxscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311200175 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=148.163.156.1; envelope-from=milesg@linux.vnet.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1700524408646100007 Content-Type: text/plain; charset="utf-8" The Power Hypervisor code expects to see a pca9552 device connected to the 3rd PNV I2C engine on port 1 at I2C address 0x63 (or left- justified address of 0xC6). This is used by hypervisor code to control PCIe slot power during hotplug events. Signed-off-by: Glenn Miles Reviewed-by: C=C3=A9dric Le Goater --- Changes from previous version: - Code moved from pnv_chip_power10_realize to pnv_rainier_i2c_init hw/ppc/Kconfig | 1 + hw/ppc/pnv.c | 26 ++++++++++++++++++++++++++ include/hw/ppc/pnv.h | 1 + 3 files changed, 28 insertions(+) diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig index 56f0475a8e..f77ca773cf 100644 --- a/hw/ppc/Kconfig +++ b/hw/ppc/Kconfig @@ -32,6 +32,7 @@ config POWERNV select XIVE select FDT_PPC select PCI_POWERNV + select PCA9552 =20 config PPC405 bool diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 3481a1220e..9cefcd0fd6 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -790,6 +790,7 @@ static void pnv_init(MachineState *machine) const char *bios_name =3D machine->firmware ?: FW_FILE_NAME; PnvMachineState *pnv =3D PNV_MACHINE(machine); MachineClass *mc =3D MACHINE_GET_CLASS(machine); + PnvMachineClass *pmc =3D PNV_MACHINE_GET_CLASS(machine); char *fw_filename; long fw_size; uint64_t chip_ram_start =3D 0; @@ -979,6 +980,13 @@ static void pnv_init(MachineState *machine) */ pnv->powerdown_notifier.notify =3D pnv_powerdown_notify; qemu_register_powerdown_notifier(&pnv->powerdown_notifier); + + /* + * Create/Connect any machine-specific I2C devices + */ + if (pmc->i2c_init) { + pmc->i2c_init(pnv); + } } =20 /* @@ -1877,6 +1885,22 @@ static void pnv_chip_power10_realize(DeviceState *de= v, Error **errp) qdev_get_gpio_in(DEVICE(&chip10->psi), PSIHB9_IRQ_SBE_I2C)); } + +} + +static void pnv_rainier_i2c_init(PnvMachineState *pnv) +{ + int i; + for (i =3D 0; i < pnv->num_chips; i++) { + Pnv10Chip *chip10 =3D PNV10_CHIP(pnv->chips[i]); + + /* + * Add a PCA9552 I2C device for PCIe hotplug control + * to engine 2, bus 1, address 0x63 + */ + i2c_slave_create_simple(chip10->i2c[2].busses[1], + "pca9552", 0x63); + } } =20 static uint32_t pnv_chip_power10_xscom_pcba(PnvChip *chip, uint64_t addr) @@ -2285,9 +2309,11 @@ static void pnv_machine_power10_class_init(ObjectCla= ss *oc, void *data) static void pnv_machine_p10_rainier_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); + PnvMachineClass *pmc =3D PNV_MACHINE_CLASS(oc); =20 pnv_machine_p10_common_class_init(oc, data); mc->desc =3D "IBM PowerNV (Non-Virtualized) POWER10 rainier"; + pmc->i2c_init =3D pnv_rainier_i2c_init; } =20 static bool pnv_machine_get_hb(Object *obj, Error **errp) diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h index 7e5fef7c43..110ac9aace 100644 --- a/include/hw/ppc/pnv.h +++ b/include/hw/ppc/pnv.h @@ -76,6 +76,7 @@ struct PnvMachineClass { int compat_size; =20 void (*dt_power_mgt)(PnvMachineState *pnv, void *fdt); + void (*i2c_init)(PnvMachineState *pnv); }; =20 struct PnvMachineState { --=20 2.31.1