From patchwork Wed Sep 8 18:39:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Grimm X-Patchwork-Id: 1525988 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=AwB9rQ3/; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4H4WBf5yKLz9sXV for ; Thu, 9 Sep 2021 04:39:22 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4H4WBf4tlHz2yLv for ; Thu, 9 Sep 2021 04:39:22 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=AwB9rQ3/; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=grimm@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=AwB9rQ3/; dkim-atps=neutral Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4H4WBW70g4z2yJ8 for ; Thu, 9 Sep 2021 04:39:15 +1000 (AEST) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 188IXX4j157767 for ; Wed, 8 Sep 2021 14:39:13 -0400 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=oddrcPLWFZHiai6Z3P68Qua7R8IRyKj2enE6REtZuD8=; b=AwB9rQ3/Y1TmNtECIpTDV94iojH8oazi9Rx8wSxhbFi7xRLYH+gw7H7VqQ8/ddUOAmDF 4c9Q/jfZRPlaPtssHL22K/UOId1GSW143vUsR+or8lo6UwA7OFwcUSVeVpjt7VGGSy5P gL2g953YG4Ayn9yoDS47c5RJDJdTS1TTpBbBe8cIcOgprTPL+0+LCTXNsOpjC09kNHq3 Xe3ibAoXA7vdX1iGUntdRxpLzvsuVKGX4AkoKDsE4mvOZIxG9Agq0fwryP5qBBVBDt6L WKSuQp1HMVdLMXvXIFchtpUsb+UUQy2WXeI/ulW4J5fmYw0ecJIQ05D6b9D2urh1q+ui CA== Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0b-001b2d01.pphosted.com with ESMTP id 3axmvn4gj4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 08 Sep 2021 14:39:13 -0400 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 188IXK8b007760 for ; Wed, 8 Sep 2021 18:39:12 GMT Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by ppma05wdc.us.ibm.com with ESMTP id 3axcnntrnh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 08 Sep 2021 18:39:12 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 188IdBpM48234780 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Sep 2021 18:39:11 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 21E1CC605A; Wed, 8 Sep 2021 18:39:11 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D5319C6055; Wed, 8 Sep 2021 18:39:10 +0000 (GMT) Received: from bml86.aus.stglabs.ibm.com (unknown [9.3.136.162]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 8 Sep 2021 18:39:10 +0000 (GMT) From: Ryan Grimm To: skiboot@lists.ozlabs.org Date: Wed, 8 Sep 2021 13:39:01 -0500 Message-Id: <20210908183901.3773783-2-grimm@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210908183901.3773783-1-grimm@linux.ibm.com> References: <20210908183901.3773783-1-grimm@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: CvAWMfebqpXjr-o864m5BFFqxuE21m3D X-Proofpoint-ORIG-GUID: CvAWMfebqpXjr-o864m5BFFqxuE21m3D X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-09-08_06:2021-09-07, 2021-09-08 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 mlxlogscore=951 suspectscore=0 impostorscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109030001 definitions=main-2109080116 Subject: [Skiboot] [RFC PATCH 1/1] AWAN CHIP HACK: Flush console buffer to memory X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ryan Grimm Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Flush console buffer to memory every 128 bytes so utilties that read the DIMMs will be able to access the console. Also flush the memcons structure so we know when the console is updated. Signed-off-by: Ryan Grimm --- core/console.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/console.c b/core/console.c index 2a1509025..ee2dac110 100644 --- a/core/console.c +++ b/core/console.c @@ -174,6 +174,9 @@ bool flush_console(void) return ret; } +static size_t total_bytes = 0; +static int total_cache_lines = 0; + static void inmem_write(char c) { uint32_t opos; @@ -186,6 +189,16 @@ static void inmem_write(char c) con_wrapped = true; } + total_bytes++; + if (total_bytes > 127) { + asm volatile("dcbf %0,%1" + : + : "a" (INMEM_CON_START), "b" ((total_cache_lines % (INMEM_CON_LEN / 128)) * 128) + : "memory"); + total_cache_lines++; + total_bytes = 0; + } + /* * We must always re-generate memcons.out_pos because * under some circumstances, the console script will @@ -247,6 +260,10 @@ ssize_t console_write(bool flush_to_drivers, const void *buf, size_t count) if (need_unlock) unlock(&con_lock); + asm volatile("dcbf %0,%1" + : + : "r" (0), "b" (&memcons) + : "memory"); return count; }