From nobody Thu Nov 14 17:57:28 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1708331546; cv=none; d=zohomail.com; s=zohoarc; b=Sz0fSRrjc/ZxkMeVQ9pKOve07/J1zpx+fph9VmIZGO36LejRaY1MvOJlbgQHgbidpv1tCt0XER9KO6iFgTEJV172/ijGnU7TaYFSnHXtvWwVlOExXuXe2UcsT/TuzY9txSqcG5kZjUhI9wEbJlIHIEUUQ9u+CjsyjZ2LQUVVP8s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708331546; h=Content-Type: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=PwPtUyKyEVd6AyaLlqPC6tZGZHAetOay6q3kchulGSU=; b=HqnmVNZ/lDuZS9rTmM0+UosozFcYg3r5d4IdmofqVP6Wt1Np7e5MWV+vKE9zZgAhwVYxgsZtI2mYNmWXqxuvOSCZMCSbPnqWnVwjrFriKjzZUQSFPRQz3Jl1kQZxA+PCnUgwFlxQR1iHflV8+yRtVa2ZTTXOoriOhu3xAPFe/hw= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 170833154662954.96298963515983; Mon, 19 Feb 2024 00:32:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rbz4M-0004iq-9f; Mon, 19 Feb 2024 03:32:12 -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 1rbz4I-0004Rd-57; Mon, 19 Feb 2024 03:32:06 -0500 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rbz4F-0002XH-07; Mon, 19 Feb 2024 03:32:05 -0500 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6da202aa138so2745969b3a.2; Mon, 19 Feb 2024 00:32:01 -0800 (PST) Received: from wheely.local0.net ([1.146.38.93]) by smtp.gmail.com with ESMTPSA id mo7-20020a1709030a8700b001db5ecd115bsm3838348plb.276.2024.02.19.00.31.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 00:32:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708331520; x=1708936320; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PwPtUyKyEVd6AyaLlqPC6tZGZHAetOay6q3kchulGSU=; b=OhNbr7EiadrV2Caksoi3i3ibKMdi4lEl3ApxiZUsK5hisw4FkrHqx1Yy2lbQp1naIN 4cJle1zheaqDW52q5PBtuitJ5WncU2q7AdwZ2naEZ4/QJ8R0bJeP2L3kjMXbksRiWnft /O1y0lDpGPB6PHQ96fNVYzSZHWsyduZRfUmsEiHfXYkXvZcLoB4NyveR9TzHchy1HkAo wkkl2nyPNf7LqDq2YBt8Wix7M3GcfK0DDo3TWjK5+vaAKcelrmLLi4ihj/ot4PSrrB0n 1QqNOVQ3fgMonFK8n6mut/iYXfnbq0gO9U997D48MSYuWWNqDUOMmJ+akmYxKHhJ5NU8 CV+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708331520; x=1708936320; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PwPtUyKyEVd6AyaLlqPC6tZGZHAetOay6q3kchulGSU=; b=bmOg8XePsiHqYxRjXkjFRAiw3UAoS3ExO+kZWFx2rKnhn5Uy6O/KnDhTTy2AbzpYgL /BLAkpsv4/OwpqT6V1VfzbImfbHHgRjOsTT5qg8LArwTar9UDL3En2WKYRyQWrcS6Ewx LGzr3GcMGWWErlrgcHk4aJfOHBHj3UWbQgzjp+jnSWjFqLCO9w3hheCUR/T7u+pdDkSM 175fP8gWhFnVuFIIUTfn+srtJ3zRHDumus6LBuz194gaoL1J/psdw2OBOAcwNVntqZ00 4bkCMeZH5M/jqIhI+pGTODPBXL0EtX5l4JkeGjR/jiF5PbRqQtkXGWVROUFfVVILHYVU rD1g== X-Forwarded-Encrypted: i=1; AJvYcCX8TIF4oEUwFRnT3UVcPnYMxP+8QhddnupwNleuv3qo1qanZa1osgJjAY98t1ndvPJNzi36zYl+361Olwna75ENGuF3 X-Gm-Message-State: AOJu0Yyv96G1eJrg3ma/C/UtRXxBu/flRUMw2+AwPypffqU7hOFrlmvy ePx+YlDVQDYSk6wkWuVeYbUVkx7x9PIaHb2kEnMYhteec9VeBfJNaPFNttU4 X-Google-Smtp-Source: AGHT+IFOx4jAkl8yw1lxKn13heUoYIpoH1uCd5iGjtyBTgj9McWTAzvqgsoA3GhYu6BNYFCPO2Qp3g== X-Received: by 2002:a05:6a20:a814:b0:19e:39d4:284c with SMTP id cb20-20020a056a20a81400b0019e39d4284cmr10917704pzb.29.1708331520478; Mon, 19 Feb 2024 00:32:00 -0800 (PST) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Harsh Prateek Bora , Glenn Miles Subject: [PULL 27/49] ppc/pnv: Wire up pca9552 GPIO pins for PCIe hotplug power control Date: Mon, 19 Feb 2024 18:29:16 +1000 Message-ID: <20240219082938.238302-28-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240219082938.238302-1-npiggin@gmail.com> References: <20240219082938.238302-1-npiggin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @gmail.com) X-ZM-MESSAGEID: 1708331548315100003 From: Glenn Miles For power10-rainier, a pca9552 device is used for PCIe slot hotplug power control by the Power Hypervisor code. The code expects that some time after it enables power to a PCIe slot by asserting one of the pca9552 GPIO pins 0-4, it should see a "power good" signal asserted on one of pca9552 GPIO pins 5-9. To simulate this behavior, we simply connect the GPIO outputs for pins 0-4 to the GPIO inputs for pins 5-9. Each PCIe slot is assigned 3 GPIO pins on the pca9552 device, for control of up to 5 PCIe slots. The per-slot signal names are: SLOTx_EN.......PHYP uses this as an output to enable slot power. We connect this to the SLOTx_PG pin to simulate a PGOOD signal. SLOTx_PG.......PHYP uses this as in input to detect PGOOD for the slot. For our purposes we just connect this to the SLOTx_EN output. SLOTx_Control..PHYP uses this as an output to prevent a race condition in the real hotplug circuitry, but we can ignore this output for simulation. Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: Glenn Miles Signed-off-by: Nicholas Piggin --- hw/ppc/pnv.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 78f5c6262a..97bdfb2d1e 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1900,7 +1900,19 @@ static void pnv_rainier_i2c_init(PnvMachineState *pn= v) * 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); + I2CSlave *dev =3D i2c_slave_create_simple(chip10->i2c[2].busses[1], + "pca9552", 0x63); + + /* + * Connect PCA9552 GPIO pins 0-4 (SLOTx_EN) outputs to GPIO pins 5= -9 + * (SLOTx_PG) inputs in order to fake the pgood state of PCIe slots + * after hypervisor code sets a SLOTx_EN pin high. + */ + qdev_connect_gpio_out(DEVICE(dev), 0, qdev_get_gpio_in(DEVICE(dev)= , 5)); + qdev_connect_gpio_out(DEVICE(dev), 1, qdev_get_gpio_in(DEVICE(dev)= , 6)); + qdev_connect_gpio_out(DEVICE(dev), 2, qdev_get_gpio_in(DEVICE(dev)= , 7)); + qdev_connect_gpio_out(DEVICE(dev), 3, qdev_get_gpio_in(DEVICE(dev)= , 8)); + qdev_connect_gpio_out(DEVICE(dev), 4, qdev_get_gpio_in(DEVICE(dev)= , 9)); } } =20 --=20 2.42.0