From patchwork Sat Aug 19 21:40:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 803596 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="qBblVHiZ"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xZYLT4RlCz9sN5 for ; Sun, 20 Aug 2017 07:41:37 +1000 (AEST) Received: from localhost ([::1]:38159 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1djBUt-0000FO-8V for incoming@patchwork.ozlabs.org; Sat, 19 Aug 2017 17:41:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41819) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1djBUD-0000DY-BF for qemu-devel@nongnu.org; Sat, 19 Aug 2017 17:40:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1djBUA-0007Fl-VE for qemu-devel@nongnu.org; Sat, 19 Aug 2017 17:40:53 -0400 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]:36217) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1djBUA-00078d-P7 for qemu-devel@nongnu.org; Sat, 19 Aug 2017 17:40:50 -0400 Received: by mail-pf0-x244.google.com with SMTP id t83so3486688pfj.3 for ; Sat, 19 Aug 2017 14:40:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Kt85tNs/v/YRp8+R3YmTS4DAlihquaA5HFUEzSSY11w=; b=qBblVHiZY07u15DilQ1jQkzEmi71WO3sI6AIekVWszWhJIrPrKLmAkwLzgfF9kLYnF Gc6RVMrb4s+MmxFzSvg4AwN9c9ejl8E4jpKnCn4qPycgs8gnbALZL57jUM58LrUlbABC wEA/86CdMThY6ZlygDY2IPgN96xS+SApdh+EgAL6n92htKAPWwVZgTVn5p3jrbUujfCv e6z2o/U5kpQmxYrYnbJc7H7+G035Mm86FY77ZVqCaD2uXRTg6STgN1nprE9awf2TvdGP TmvRdaCYWI6r64DRdNj+lRe7pHvUwfV5xaPq4kBf7I842j7ovQFeziAyWx99eH5w/4I9 u14g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Kt85tNs/v/YRp8+R3YmTS4DAlihquaA5HFUEzSSY11w=; b=uQsr6IQoWnlvLEAhfknzWkJcDWzIiyM9YSTzoj3klm4v7v0cbqJiYp7jElmy1JAdxO 3WHKTF7dcAC+yySUUoAo5gsHq2jV/J8LJCbK5G6dC6zUeuhRtMpunYGWR6oprbR9skqK l5pI0FmfhaPFx+zhR/WhV0HKEOOWELD5JI15K54OOpeB7bFWrQMdwjoAByDCxfZcuefD d/hsQOCIMm4q3H6Rqb7LoQVflTyCv6Z/uwQNy5HK2q3+0aBsI8XBL1JGrdv47YdrYH3P D0jZGOn2IAEzzg/nLfSBhgPO9YhZvJfg2WkxP3+v1AMm31b1Kl6YRep9hxXlSuiG51vv 2W+g== X-Gm-Message-State: AHYfb5ipexIstJwQ5hrQlw7Sx4c13DrmVmF2Gra+6nG4Tv7nsF4H39Fg Y0okChZRt+S7RQ== X-Received: by 10.99.49.20 with SMTP id x20mr12444886pgx.102.1503178848258; Sat, 19 Aug 2017 14:40:48 -0700 (PDT) Received: from serve.minyard.net ([47.184.154.34]) by smtp.gmail.com with ESMTPSA id h8sm17105881pfe.81.2017.08.19.14.40.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Aug 2017 14:40:46 -0700 (PDT) Received: from t430.minyard.net (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPA id DEE4093F; Sat, 19 Aug 2017 16:40:44 -0500 (CDT) Received: by t430.minyard.net (Postfix, from userid 1000) id 56E5930009D; Sat, 19 Aug 2017 16:40:43 -0500 (CDT) From: minyard@acm.org To: qemu-devel@nongnu.org Date: Sat, 19 Aug 2017 16:40:39 -0500 Message-Id: <1503178840-21512-3-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503178840-21512-1-git-send-email-minyard@acm.org> References: <1503178840-21512-1-git-send-email-minyard@acm.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::244 Subject: [Qemu-devel] [PATCH 2/3] ipmi: Don't set the timestamp on add events that don't have it X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Corey Minyard , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Corey Minyard According to the spec, event types from 0x0e to 0xff do not have a timestamp. So don't set it when adding those types. This required putting the timestamp in a temporary buffer, since it's still required to set the last addition time. Signed-off-by: Corey Minyard Reviewed-by: Cédric Le Goater --- hw/ipmi/ipmi_bmc_sim.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c index 1c732aa..0f191e8 100644 --- a/hw/ipmi/ipmi_bmc_sim.c +++ b/hw/ipmi/ipmi_bmc_sim.c @@ -443,16 +443,20 @@ static void sel_inc_reservation(IPMISel *sel) /* Returns 1 if the SEL is full and can't hold the event. */ static int sel_add_event(IPMIBmcSim *ibs, uint8_t *event) { + uint8_t ts[4]; + event[0] = 0xff; event[1] = 0xff; - set_timestamp(ibs, event + 3); + set_timestamp(ibs, ts); + if (event[2] < 0xe0) /* Don't set timestamps for these, per the spec. */ + memcpy(event + 3, ts, 4); if (ibs->sel.next_free == MAX_SEL_SIZE) { ibs->sel.overflow = 1; return 1; } event[0] = ibs->sel.next_free & 0xff; event[1] = (ibs->sel.next_free >> 8) & 0xff; - memcpy(ibs->sel.last_addition, event + 3, 4); + memcpy(ibs->sel.last_addition, ts, 4); memcpy(ibs->sel.sel[ibs->sel.next_free], event, 16); ibs->sel.next_free++; sel_inc_reservation(&ibs->sel);