Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/633503/?format=api
{ "id": 633503, "url": "http://patchwork.ozlabs.org/api/patches/633503/?format=api", "web_url": "http://patchwork.ozlabs.org/project/skiboot/patch/1465535032-26749-2-git-send-email-gwshan@linux.vnet.ibm.com/", "project": { "id": 44, "url": "http://patchwork.ozlabs.org/api/projects/44/?format=api", "name": "skiboot firmware development", "link_name": "skiboot", "list_id": "skiboot.lists.ozlabs.org", "list_email": "skiboot@lists.ozlabs.org", "web_url": "http://github.com/open-power/skiboot", "scm_url": "http://github.com/open-power/skiboot", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1465535032-26749-2-git-send-email-gwshan@linux.vnet.ibm.com>", "list_archive_url": null, "date": "2016-06-10T05:03:30", "name": "[v12,01/23] hw/p8-i2c: Allow to set I2C request timeout", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "92d9402c3303303cc0ff154499b4043e861ed816", "submitter": { "id": 63923, "url": "http://patchwork.ozlabs.org/api/people/63923/?format=api", "name": "Gavin Shan", "email": "gwshan@linux.vnet.ibm.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/skiboot/patch/1465535032-26749-2-git-send-email-gwshan@linux.vnet.ibm.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/633503/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/633503/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "skiboot@lists.ozlabs.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "skiboot@lists.ozlabs.org" ], "Received": [ "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3rQqqn03v3z9sD3\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 10 Jun 2016 15:05:25 +1000 (AEST)", "from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3rQqqm5yd8zDqJq\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 10 Jun 2016 15:05:24 +1000 (AEST)", "from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com\n\t[148.163.158.5])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3rQqqJ3clbzDq5s\n\tfor <skiboot@lists.ozlabs.org>; Fri, 10 Jun 2016 15:05:00 +1000 (AEST)", "from pps.filterd (m0098413.ppops.net [127.0.0.1])\n\tby mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id\n\tu5A53sR1031126\n\tfor <skiboot@lists.ozlabs.org>; Fri, 10 Jun 2016 01:04:58 -0400", "from e23smtp01.au.ibm.com (e23smtp01.au.ibm.com [202.81.31.143])\n\tby mx0b-001b2d01.pphosted.com with ESMTP id 23fm6eawhn-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <skiboot@lists.ozlabs.org>; Fri, 10 Jun 2016 01:04:58 -0400", "from localhost\n\tby e23smtp01.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <skiboot@lists.ozlabs.org> from <gwshan@linux.vnet.ibm.com>;\n\tFri, 10 Jun 2016 15:04:55 +1000", "from d23dlp01.au.ibm.com (202.81.31.203)\n\tby e23smtp01.au.ibm.com (202.81.31.207) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tFri, 10 Jun 2016 15:04:53 +1000", "from d23relay09.au.ibm.com (d23relay09.au.ibm.com [9.185.63.181])\n\tby d23dlp01.au.ibm.com (Postfix) with ESMTP id 75A0D2CE8063\n\tfor <skiboot@lists.ozlabs.org>; Fri, 10 Jun 2016 15:04:42 +1000 (EST)", "from d23av05.au.ibm.com (d23av05.au.ibm.com [9.190.234.119])\n\tby d23relay09.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n\tu5A54We65177812\n\tfor <skiboot@lists.ozlabs.org>; Fri, 10 Jun 2016 15:04:32 +1000", "from d23av05.au.ibm.com (localhost [127.0.0.1])\n\tby d23av05.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id\n\tu5A54GSa023770\n\tfor <skiboot@lists.ozlabs.org>; Fri, 10 Jun 2016 15:04:17 +1000", "from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.192.253.14])\n\tby d23av05.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id\n\tu5A54Gou023761; Fri, 10 Jun 2016 15:04:16 +1000", "from bran.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114])\n\tby ozlabs.au.ibm.com (Postfix) with ESMTP id 1A516A010D;\n\tFri, 10 Jun 2016 15:03:55 +1000 (AEST)", "from gwshan (shangw.ozlabs.ibm.com [10.61.2.199])\n\tby bran.ozlabs.ibm.com (Postfix) with ESMTP id 08CF7E3B18;\n\tFri, 10 Jun 2016 15:03:55 +1000 (AEST)", "by gwshan (Postfix, from userid 1000)\n\tid E0BE5942CA3; Fri, 10 Jun 2016 15:03:54 +1000 (AEST)" ], "X-IBM-Helo": "d23dlp01.au.ibm.com", "X-IBM-MailFrom": "gwshan@linux.vnet.ibm.com", "X-IBM-RcptTo": "skiboot@lists.ozlabs.org", "From": "Gavin Shan <gwshan@linux.vnet.ibm.com>", "To": "skiboot@lists.ozlabs.org", "Date": "Fri, 10 Jun 2016 15:03:30 +1000", "X-Mailer": "git-send-email 2.1.0", "In-Reply-To": "<1465535032-26749-1-git-send-email-gwshan@linux.vnet.ibm.com>", "References": "<1465535032-26749-1-git-send-email-gwshan@linux.vnet.ibm.com>", "X-TM-AS-MML": "disable", "X-Content-Scanned": "Fidelis XPS MAILER", "x-cbid": "16061005-1617-0000-0000-0000012AC821", "X-IBM-AV-DETECTION": "SAVI=unused REMOTE=unused XFE=unused", "x-cbparentid": "16061005-1618-0000-0000-0000460A8BF5", "Message-Id": "<1465535032-26749-2-git-send-email-gwshan@linux.vnet.ibm.com>", "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2016-06-10_04:, , signatures=0", "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=3\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000\n\tdefinitions=main-1606100058", "Subject": "[Skiboot] [PATCH v12 01/23] hw/p8-i2c: Allow to set I2C request\n\ttimeout", "X-BeenThere": "skiboot@lists.ozlabs.org", "X-Mailman-Version": "2.1.22", "Precedence": "list", "List-Id": "Mailing list for skiboot development <skiboot.lists.ozlabs.org>", "List-Unsubscribe": "<https://lists.ozlabs.org/options/skiboot>,\n\t<mailto:skiboot-request@lists.ozlabs.org?subject=unsubscribe>", "List-Archive": "<http://lists.ozlabs.org/pipermail/skiboot/>", "List-Post": "<mailto:skiboot@lists.ozlabs.org>", "List-Help": "<mailto:skiboot-request@lists.ozlabs.org?subject=help>", "List-Subscribe": "<https://lists.ozlabs.org/listinfo/skiboot>,\n\t<mailto:skiboot-request@lists.ozlabs.org?subject=subscribe>", "Cc": "alistair@popple.id.au", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Errors-To": "skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org", "Sender": "\"Skiboot\"\n\t<skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>" }, "content": "Prior to PCI enumeration, the PHB slot's power state might be changed\nduring fundamental reset. The fundamental reset is implemented by state\nmachine and it's driven by a polling mechanism in predetermined interval\n(A). On the other hand, PCI slot's power supply is controlled by I2C\nchip on Firenze platform. It means the PCI slot's power supply state is\nchanged through I2C request which has a timeout timer running in variable\ninterval (B).\n\nComparing to (A), (B) is small and short. That means I2C timeout is reached\nbefore first poll running in interval of (A). It's unexpected behaviour.\nThis allows to set I2C request timeout ((B)) to avoid the issue.\n\nSigned-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>\nReviewed-by: Stewart Smith <stewart@linux.vnet.ibm.com>\n---\n hw/p8-i2c.c | 25 +++++++++++++++++++++++--\n include/i2c.h | 9 +++++++++\n 2 files changed, 32 insertions(+), 2 deletions(-)", "diff": "diff --git a/hw/p8-i2c.c b/hw/p8-i2c.c\nindex 593eb88..fde9a80 100644\n--- a/hw/p8-i2c.c\n+++ b/hw/p8-i2c.c\n@@ -386,10 +386,15 @@ static int p8_i2c_prog_mode(struct p8_i2c_master_port *port, bool enhanced_mode)\n static void p8_i2c_complete_request(struct p8_i2c_master *master,\n \t\t\t\t struct i2c_request *req, int ret)\n {\n+\tstruct p8_i2c_request *request =\n+\t\tcontainer_of(req, struct p8_i2c_request, req);\n+\n \t/* We only complete the current top level request */\n \tassert(req == list_top(&master->req_list, struct i2c_request, link));\n \n \tcancel_timer_async(&master->timeout);\n+\trequest->timeout = 0ul;\n+\n \tlist_del(&req->link);\n \tmaster->state = state_idle;\n \treq->result = ret;\n@@ -973,8 +978,12 @@ static int p8_i2c_start_request(struct p8_i2c_master *master,\n \tnow = schedule_timer(&master->poller, master->poll_interval);\n \n \t/* Calculate and start timeout */\n-\ttbytes = req->rw_len + req->offset_bytes + 2;\n-\trequest->timeout = now + tbytes * master->byte_timeout;\n+\tif (request->timeout) {\n+\t\trequest->timeout += now;\n+\t} else {\n+\t\ttbytes = req->rw_len + req->offset_bytes + 2;\n+\t\trequest->timeout = now + tbytes * master->byte_timeout;\n+\t}\n \n \t/* Start the timeout */\n \tschedule_timer_at(&master->timeout, request->timeout);\n@@ -1046,6 +1055,15 @@ static void p8_i2c_free_request(struct i2c_request *req)\n \tfree(request);\n }\n \n+static void p8_i2c_set_request_timeout(struct i2c_request *req,\n+\t\t\t\t uint64_t duration)\n+{\n+\tstruct p8_i2c_request *request =\n+\t\tcontainer_of(req, struct p8_i2c_request, req);\n+\n+\trequest->timeout = msecs_to_tb(duration);\n+}\n+\n static inline uint32_t p8_i2c_get_bit_rate_divisor(uint32_t lb_freq,\n \t\t\t\t\t\t uint32_t bus_speed)\n {\n@@ -1093,6 +1111,8 @@ static void p8_i2c_timeout(struct timer *t __unused, void *data, uint64_t now)\n \t\tDBG(\"I2C: Timeout with request not expired\\n\");\n \t\tgoto exit;\n \t}\n+\n+\trequest->timeout = 0ul;\n \tport = container_of(req->bus, struct p8_i2c_master_port, bus);\n \n \t/* Allright, we have a request and it has timed out ... */\n@@ -1372,6 +1392,7 @@ static void p8_i2c_init_one(struct dt_node *i2cm, enum p8_i2c_master_type type)\n \t\tport->bus.queue_req = p8_i2c_queue_request;\n \t\tport->bus.alloc_req = p8_i2c_alloc_request;\n \t\tport->bus.free_req = p8_i2c_free_request;\n+\t\tport->bus.set_req_timeout = p8_i2c_set_request_timeout;\n \t\ti2c_add_bus(&port->bus);\n \n \t\t/* Add OPAL properties to the bus node */\ndiff --git a/include/i2c.h b/include/i2c.h\nindex dea0644..83c6ec5 100644\n--- a/include/i2c.h\n+++ b/include/i2c.h\n@@ -26,6 +26,8 @@ struct i2c_bus {\n \tint\t\t\t(*queue_req)(struct i2c_request *req);\n \tstruct i2c_request\t*(*alloc_req)(struct i2c_bus *bus);\n \tvoid\t\t\t(*free_req)(struct i2c_request *req);\n+\tvoid\t\t\t(*set_req_timeout)(struct i2c_request *req,\n+\t\t\t\t\t\t uint64_t duration);\n };\n \n /*\n@@ -80,6 +82,13 @@ static inline int i2c_queue_req(struct i2c_request *req)\n \treturn req->bus->queue_req(req);\n }\n \n+static inline void i2c_set_req_timeout(struct i2c_request *req,\n+\t\t\t\t uint64_t duration)\n+{\n+\tif (req->bus->set_req_timeout)\n+\t\treq->bus->set_req_timeout(req, duration);\n+}\n+\n /* P8 implementation details */\n extern void p8_i2c_init(void);\n extern void p8_i2c_interrupt(uint32_t chip_id);\n", "prefixes": [ "v12", "01/23" ] }