summaryrefslogtreecommitdiff
path: root/drivers/soc/aspeed
AgeCommit message (Collapse)AuthorFilesLines
2022-06-09soc: aspeed: mctp: Add IOCTL to set own EIDIwona Winiarska1-0/+18
The driver doesn't implement MCTP logic, which means that it requires its clients to prepare valid MCTP over PCIe packets. Because we support MCTP stacks in both kernel and userspace, and since MCTP protocol is a part of userspace, we need userspace to update own EID information in kernel to provide it for in-kernel aspeed-mctp clients. Previously, own EID information was updated by userspace using SET_EID_INFO which now is deprecated and replaced by SET_EID_EXT_INFO to pass CPU EID and Domain ID mappings. To provide own EID information for in-kernel clients, add a dedicated IOCTL. Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com>
2022-05-12Merge commit '49caedb668e476c100d727f2174724e0610a2b92' of ↵Sujoy Ray4-2/+97
https://github.com/openbmc/linux into openbmc/dev-5.15-intel-bump_v5.15.36 Signed-off-by: Sujoy Ray <sujoy.ray@intel.com>
2022-04-15soc: aspeed: mctp: Extend internal aspeed-mctp driver APIKrzysztof Richert1-0/+22
New API allows to read DomainId information by internal kernel clients (for example peci-mctp). Signed-off-by: Krzysztof Richert <krzysztof.richert@intel.com>
2022-04-15soc: aspeed: mctp: Add IOCTLs for extended EID informationKrzysztof Richert1-20/+63
For PECI over MCTP purposes, aspeed-mctp driver needs to be extended that allows to set Domain ID information. Signed-off-by: Krzysztof Richert <krzysztof.richert@intel.com>
2022-04-15soc: aspeed: xdma: Add trace eventsEddie James1-2/+16
Trace the flow of the driver to aid debugging after an error. OpenBMC-Staging-Count: 1 Signed-off-by: Eddie James <eajames@linux.ibm.com> Acked-by: Andrew Jeffery <andrew@aj.id.au> Link: https://lore.kernel.org/r/20220412215331.42491-1-eajames@linux.ibm.com Signed-off-by: Joel Stanley <joel@jms.id.au>
2022-03-31soc: aspeed: Correct mutex trylock checkVikash Chandola1-1/+1
Correct mutex_trylock to proceed if there is no contention otherwise return otherwise EBUSY. Signed-off-by: Vikash Chandola <vikash.chandola@intel.com>
2022-03-23soc: aspeed: Add support for eSPI Virtual WireAnkita Prasad4-1/+123
The Aspeed eSPI controller is a slave device to communicate with the master through the Enhanced Serial Peripheral Interface (eSPI). It supports all eSPI channels including the Virtual Wire that is used to transmit the sideband signal information to/from Management Controller (e.g. BMC). Add support for the Virtual Wire channel. Add IOCTL handler to support reading and writing GPIO value over the Virtual Wire channel. Signed-off-by: Ankita Prasad <ankita.prasad@intel.com>
2022-03-16ARM: soc: aspeed: Update secure boot controller supportJoel Stanley1-9/+11
Pick up changes from v2: - Place files in aspeed/sbc - Check for error when creating directory - Print secure boot message even if debugfs is disabled OpenBMC-Staging-Count: 1 Signed-off-by: Joel Stanley <joel@jms.id.au>
2022-03-12soc: aspeed: Add support for eSPI OOB channelVikash Chandola6-11/+621
Add eSPI OOB channel slave. Add new device file to transact eSPI OOB messages with eSPI master in PCH. Signed-off-by: Vikash Chandola <vikash.chandola@intel.com>
2022-03-12soc: aspeed: Refactor aspeed espi slaveVikash Chandola2-96/+334
Move ASPEED_ESPI macro definitions to a aspeed-espi-ctrl header file. Fix the compilation warning: drivers/soc/aspeed/aspeed-espi-slave.c: In function 'aspeed_espi_pltrstn_open': drivers/soc/aspeed/aspeed-espi-slave.c:286:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] 286 | struct aspeed_espi *priv = to_aspeed_espi(filp); | ^~~~~~ Signed-off-by: Vikash Chandola <vikash.chandola@intel.com>
2022-03-08Merge tag 'v5.15.26' into dev-5.15Joel Stanley1-4/+3
This is the 5.15.26 stable release Signed-off-by: Joel Stanley <joel@jms.id.au>
2022-03-07ARM: soc: aspeed: Add secure boot controller supportJoel Stanley3-0/+79
This reads out the status of the secure boot controller and exposes it in debugfs. An example on a AST2600A3 QEMU model: # grep -r . /sys/kernel/debug/aspeed/* /sys/kernel/debug/aspeed/abr_image:0 /sys/kernel/debug/aspeed/low_security_key:0 /sys/kernel/debug/aspeed/otp_protected:0 /sys/kernel/debug/aspeed/secure_boot:1 /sys/kernel/debug/aspeed/uart_boot:0 On boot the state of the system according to the secure boot controller will be printed: [ 0.037634] AST2600 secure boot enabled or [ 0.037935] AST2600 secure boot disabled OpenBMC-Staging-Count: 1 Reviewed-by: Andrew Jeffery <andrew@aj.id.au> Link: https://lore.kernel.org/r/20220304030336.1017197-1-joel@jms.id.au Signed-off-by: Joel Stanley <joel@jms.id.au>
2022-02-23soc: aspeed: lpc-ctrl: Block error printing on probe defer casesJae Hyun Yoo1-4/+3
[ Upstream commit 301a5d3ad2432d7829f59432ca0a93a6defbb9a1 ] Add a checking code when it gets -EPROBE_DEFER while getting a clock resource. In this case, it doesn't need to print out an error message because the probing will be re-visited. Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com> Signed-off-by: Joel Stanley <joel@jms.id.au> Reviewed-by: Andrew Jeffery <andrew@aj.id.au> Reviewed-by: Iwona Winiarska <iwona.winiarska@intel.com> Link: https://lore.kernel.org/r/20211104173709.222912-1-jae.hyun.yoo@intel.com Link: https://lore.kernel.org/r/20220201070118.196372-1-joel@jms.id.au' Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-12-15soc: aspeed: lpc-mbox: Avoid calling kfifo_to_user in atomic contextIwona Winiarska1-45/+33
kfifo_to_user() can sleep, which means that calling it in atomic context can cause deadlock. aspeed-lpc-mbox is calling it under spin_lock_irqsave(), causing the following lockdep splat: [ 44.939994] BUG: sleeping function called from invalid context at include/linux/uaccess.h:174 [ 44.949549] in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 282, name: host-misc-manag [ 44.959280] INFO: lockdep is turned off. [ 44.963657] irq event stamp: 5950 [ 44.967361] hardirqs last enabled at (5949): [<802ba0cc>] get_page_from_freelist+0xf1c/0x1358 [ 44.977005] hardirqs last disabled at (5950): [<80a605e4>] _raw_spin_lock_irqsave+0x80/0x84 [ 44.986350] softirqs last enabled at (5908): [<80838a80>] release_sock+0x8c/0xa8 [ 44.994723] softirqs last disabled at (5906): [<80838a1c>] release_sock+0x28/0xa8 [ 45.003099] CPU: 0 PID: 282 Comm: host-misc-manag Tainted: G W 5.15.0-14fcc87-dirty-7b64388 #1 [ 45.014198] Hardware name: Generic DT based system [ 45.019553] Backtrace: [ 45.022296] [<80a48e84>] (dump_backtrace) from [<80a49268>] (show_stack+0x20/0x24) [ 45.030771] r7:8231dcf0 r6:00000080 r5:80cb88f4 r4:600f0093 [ 45.037094] [<80a49248>] (show_stack) from [<80a5592c>] (dump_stack_lvl+0x60/0x78) [ 45.045565] [<80a558cc>] (dump_stack_lvl) from [<80a5595c>] (dump_stack+0x18/0x1c) [ 45.054037] r7:8231dcf0 r6:000000ae r5:80c9b97c r4:848ea000 [ 45.060360] [<80a55944>] (dump_stack) from [<80160d3c>] (___might_sleep+0x1b0/0x2c0) [ 45.069015] [<80160b8c>] (___might_sleep) from [<80160ebc>] (__might_sleep+0x70/0xac) [ 45.077779] r6:00000000 r5:000000ae r4:80c9b97c [ 45.082938] [<80160e4c>] (__might_sleep) from [<802a1cf8>] (__might_fault+0x48/0xb0) [ 45.091606] r6:02363388 r5:00000000 r4:ffffe000 [ 45.096756] [<802a1cb0>] (__might_fault) from [<8058d564>] (kfifo_copy_to_user+0x74/0x1dc) [ 45.106006] r5:00000020 r4:00000020 [ 45.110002] [<8058d4f0>] (kfifo_copy_to_user) from [<8058dc04>] (__kfifo_to_user+0x58/0x78) [ 45.119340] r9:848ea000 r8:02363388 r7:00000020 r6:848ebe90 r5:00000020 r4:8231dcf0 [ 45.127992] [<8058dbac>] (__kfifo_to_user) from [<8060fc40>] (aspeed_mbox_read+0xe0/0x2d8) [ 45.137242] r7:848ebe90 r6:8231dd04 r5:200f0013 r4:00000020 [ 45.143567] [<8060fb60>] (aspeed_mbox_read) from [<802d6024>] (vfs_read+0xc0/0x320) [ 45.152149] r10:00000003 r9:848ea000 r8:8060fb60 r7:00000020 r6:00000001 r5:848ebf68 [ 45.160897] r4:848a9b40 [ 45.163727] [<802d5f64>] (vfs_read) from [<802d6e04>] (ksys_read+0x70/0xf4) [ 45.171529] r10:00000003 r9:848ea000 r8:80100224 r7:00000000 r6:00000000 r5:848a9b40 [ 45.180277] r4:848a9b40 [ 45.183108] [<802d6d94>] (ksys_read) from [<802d6ea0>] (sys_read+0x18/0x1c) [ 45.190906] r7:00000003 r6:7e9f9ad8 r5:76f26070 r4:0236357c [ 45.197229] [<802d6e88>] (sys_read) from [<80100060>] (ret_fast_syscall+0x0/0x1c) [ 45.205602] Exception stack(0x848ebfa8 to 0x848ebff0) [ 45.211258] bfa0: 0236357c 76f26070 00000009 02363388 00000020 00000000 [ 45.220401] bfc0: 0236357c 76f26070 7e9f9ad8 00000003 02366874 02363388 00000020 7e9f9b30 [ 45.229538] bfe0: 00526be4 7e9f9ab0 00504b88 76c1836c Rearrange the code to use mutex instead of spinlock to protect kifo_to_user, since we only need to serialize against other callers of aspeed_mbox_read(). Move kfifo_reset under spinlock to satisfy kfifo locking rules. Remove redundant MBX_USE_INTERRUPT. Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com> Change-Id: I4b3fc32d65f2614bec92460bda55daded99e096d
2021-12-15soc: aspeed: espi-slave: Avoid calling put_user in atomic contextIwona Winiarska1-24/+20
put_user() can sleep, which means that calling it in atomic context can cause deadlock. aspeed-espi-slave is calling it under spin_lock_irqsave(), resulting in the following lockdep splat: [ 18.796723] BUG: sleeping function called from invalid context at drivers/soc/aspeed/aspeed-espi-slave.c:309 [ 18.807742] in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 311, name: host-misc-manag [ 18.817486] INFO: lockdep is turned off. [ 18.821869] irq event stamp: 0 [ 18.825289] hardirqs last enabled at (0): [<00000000>] 0x0 [ 18.831551] hardirqs last disabled at (0): [<8011ed40>] copy_process+0x7b0/0x1be8 [ 18.839941] softirqs last enabled at (0): [<8011ed40>] copy_process+0x7b0/0x1be8 [ 18.848308] softirqs last disabled at (0): [<00000000>] 0x0 [ 18.854538] CPU: 0 PID: 311 Comm: host-misc-manag Not tainted 5.15.0-14fcc87-dirty-7b64388 #1 [ 18.864070] Hardware name: Generic DT based system [ 18.869421] Backtrace: [ 18.872155] [<80a48ec4>] (dump_backtrace) from [<80a492a8>] (show_stack+0x20/0x24) [ 18.880638] r7:0242c06c r6:00000080 r5:80cb88f4 r4:600d0093 [ 18.886969] [<80a49288>] (show_stack) from [<80a5596c>] (dump_stack_lvl+0x60/0x78) [ 18.895440] [<80a5590c>] (dump_stack_lvl) from [<80a5599c>] (dump_stack+0x18/0x1c) [ 18.903907] r7:0242c06c r6:00000135 r5:80d0a958 r4:8ffc2000 [ 18.910226] [<80a55984>] (dump_stack) from [<80160d3c>] (___might_sleep+0x1b0/0x2c0) [ 18.918901] [<80160b8c>] (___might_sleep) from [<80160ebc>] (__might_sleep+0x70/0xac) [ 18.927818] r6:00000000 r5:00000135 r4:80d0a958 [ 18.933024] [<80160e4c>] (__might_sleep) from [<802a1cf8>] (__might_fault+0x48/0xb0) [ 18.941690] r6:8238da58 r5:00000000 r4:ffffe000 [ 18.946848] [<802a1cb0>] (__might_fault) from [<8060ed78>] (aspeed_espi_pltrstn_read+0xac/0x254) [ 18.956679] r5:8238da80 r4:ffffe000 [ 18.960669] [<8060eccc>] (aspeed_espi_pltrstn_read) from [<802d6024>] (vfs_read+0xc0/0x320) [ 18.970011] r10:00000003 r9:8ffc2000 r8:8060eccc r7:00000001 r6:00000001 r5:8ffc3f68 [ 18.978754] r4:84eb48c0 [ 18.981582] [<802d5f64>] (vfs_read) from [<802d6e04>] (ksys_read+0x70/0xf4) [ 18.989378] r10:00000003 r9:8ffc2000 r8:80100224 r7:00000000 r6:00000000 r5:84eb48c0 [ 18.998122] r4:84eb48c0 [ 19.000946] [<802d6d94>] (ksys_read) from [<802d6ea0>] (sys_read+0x18/0x1c) [ 19.008735] r7:00000003 r6:7ec07a00 r5:76fc3070 r4:0242c220 [ 19.015055] [<802d6e88>] (sys_read) from [<80100060>] (ret_fast_syscall+0x0/0x1c) [ 19.023419] Exception stack(0x8ffc3fa8 to 0x8ffc3ff0) [ 19.029063] 3fa0: 0242c220 76fc3070 00000007 0242c06c 00000001 00000000 [ 19.038196] 3fc0: 0242c220 76fc3070 7ec07a00 00000003 0242c23c 0242c06c 00000001 00000000 [ 19.047330] 3fe0: 00446be4 7ec079d8 00424b88 76cb536c Rearrange the code to avoid calling *_user() function under spin_lock. Also, use the regular *_irq() variant instead if *_irqsave(), since it's only used for serializing process context with IRQ handler. Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com> Change-Id: Iaf17ddd17c020c8ee8c60c2fc98a57b97133e7a6
2021-11-05soc: aspeed: mctp: fix a build breakJae Hyun Yoo1-2/+2
This commit fixes a build break which is caused by an incompatible compare function parameter of list_sort() call. Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
2021-11-05soc: aspeed: mctp: Clear TX channel and client rings after resetIwona Winiarska1-15/+64
Currently, after TX channel wr_ptr reaches the maximum value, there is no mechanism to clear it. The driver expects that the HW will make forward progress, and eventually the buffer will have free space available. That's not true for some reset scenarios and when this happens, we may end up with a blocked full channel. While we could fix it by just adding a trigger after reset, this may cause userspace to receive unexpected responses for packets that got stuck in queues during reset. Let's fix it by flushing both TX channel and client rings. Note: The barriers are necessary just to enforce ordering between flush and producing new packets by the clients (we don't want to flush packets that were sent after reset, just the ones that were sent before it) but to keep things consistent, introduce helpers for all priv->pcie.bdf accesses. Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com> Change-Id: I457a05a6e7f0cb1fd8ce6f2bff6a59b166d32149
2021-11-05soc: aspeed: lpc-sio: add SMI event triggering supportJae Hyun Yoo1-0/+30
Add SMI event triggering support. Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> Change-Id: I711b5642a654e671a2d97d3079e3a1a055d400a0
2021-11-05Add chip unique id reading interfaceJae Hyun Yoo1-10/+109
This commit adds an interface for reading chip unique id value. Optionally, the id can be encrypted using a dts-supplied hash data. Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com> Signed-off-by: Arun P. Mohanan <arun.p.m@linux.intel.com> Change-Id: Ifd98500ea87b3d40e1738e583e077a74851fae35
2021-11-05soc: aspeed: mctp: Reject packets with invalid payload sizeIwona Winiarska1-9/+27
When we program TX command register, it requires packet data size in dwords. Since the aspeed-mctp driver doesn't implement MCTP protocol, it copies MCTP packet "as it" form userspace and uses size from write() syscall to program TX command. If the size from write() doesn't match the payload length in packet PCIe VDM header, it causes MCTP HW to stop working and we are not able to reset it without platform power cycle. To avoid HW issues, let's verify if the data size from write() matches the payload length in PCIe VDM header. Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com> Change-Id: I6da14babadcc65cb2ba4a2b685495d1baa92c169
2021-11-05soc: aspeed: add a raw value setting interface for uart routingJae Hyun Yoo1-17/+51
This commit adds a raw value setting interface for uart routing to provide an atomic way of switching the route. Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com> Change-Id: Id8b80f44f9a503d9f25a692211fc5ec78500ce68
2021-11-05mailbox: ioctl to fetch mailbox sizeArun P. Mohanan1-0/+20
The size of mailbox differ from AST2500, AST2600 A0 and A1. Add an ioctl support to fetch the mailbox size. Tested: Verfied ioctl call returns mailbox size as expected. Change-Id: I4e261aaf8aa3fb108d6ad152d30a17b114d70ccd Signed-off-by: Arun P. Mohanan <arun.p.m@linux.intel.com>
2021-11-05soc: aspeed: Miscellaneous control interfacesAndrew Jeffery3-0/+199
The ASPEED BMC SoCs have many knobs and switches that are sometimes design-specific and often defy any approach to unify them under an existing subsystem. Add a driver to translate a devicetree table into sysfs entries to expose bits and fields for manipulation from userspace. This encompasses concepts from scratch registers to boolean conditions to enable or disable host interface features. Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
2021-11-05soc: aspeed: mctp: Export function used to read BDFIwona Winiarska1-0/+19
Recently, aspeed-mctp driver functionality was extended to store BDF values for already discovered MCTP endpoints on PCIe bus. Let's expose kernel API to read BDF based on endpoint ID. Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com>
2021-11-05Enable mailbox interruptsYong Li1-49/+90
Support interrupt generation for both 16 and 32 mailbox registers. Tested: After applied this patch, write the mailbox registers from BIOS side, the misc manager can capture the new mailbox data. Signed-off-by: Yong Li <yong.b.li@linux.intel.com>
2021-11-05soc: aspeed: aspeed-espi-slave: fix SUS_WARN handling logicJae Hyun Yoo1-18/+27
This commit fixes SUS_WARN handling as dual-edge detection mode to support deepsx entry event properly. Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
2021-11-05Add poll fops in eSPI driverArun P. Mohanan1-24/+61
Modify eSPI driver to support poll fops. Signed-off-by: Arun P. Mohanan <arun.p.m@linux.intel.com>
2021-11-05Add AST2500 eSPI driverHaiyue Wang3-0/+474
When PCH works under eSPI mode, the PMC (Power Management Controller) in PCH is waiting for SUS_ACK from BMC after it alerts SUS_WARN. It is in dead loop if no SUS_ACK assert. This is the basic requirement for the BMC works as eSPI slave. Also for the host power on / off actions, from BMC side, the following VW (Virtual Wire) messages are done in firmware: 1. SLAVE_BOOT_LOAD_DONE / SLAVE_BOOT_LOAD_STATUS 2. SUS_ACK 3. OOB_RESET_ACK 4. HOST_RESET_ACK Also, it provides monitoring interface of PLTRST_N signal through /dev/espi-pltrstn Signed-off-by: Haiyue Wang <haiyue.wang@linux.intel.com> Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> Signed-off-by: James Feist <james.feist@linux.intel.com> Signed-off-by: Vernon Mauery <vernon.mauery@intel.com>
2021-11-05soc: aspeed: mctp: Register peci_mctp deviceIwona Winiarska1-1/+9
Now that it is possible to send PECI frames via aspeed-mctp driver, let's add aspeed-peci-mctp node to allow bind peci-mctp-aspeed adapter driver. Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com>
2021-11-05soc: aspeed: mctp: Fix TX hangs and optimize TX logicAndrzej Kacprowski1-58/+42
Currently driver submits 1 (or rarely more than 1) packet then waits until HW signals transmission completion before sending more packets. This logic requires interrupt after each packet, aspeed_mctp_tx_tasklet() is invoked twice per packet. New logic uses TX ring correctly, packets are added to the end of circular ring buffer. The driver does not have to wait for HW to complete transmission of enqueued packets before adding more packets to TX queue. Interrupt is generated only if TX ring if full. This change significantly improves packet transmission performance: PECI GetTemp command takes ~25us instead of ~30us. This change also fixes sporadic TX hangs during host reboot seen with current driver. Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>
2021-11-05soc: aspeed: mctp: Update source EID in TX packetsAndrzej Kacprowski1-1/+26
If self EID is known then the driver updates source EID in MCTP header of sent packets. For MCTP control packets the source EID is not updated as it may disrupt MCTP discovery flow. Self EID is determined from list of known endpoints provided by ASPEED_MCTP_IOCTL_SET_EID_INFO IOCTL. Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>
2021-11-05soc: aspeed: mctp: Fix RX hangs and RX packet missesAndrzej Kacprowski1-76/+133
Under even moderate traffic the driver can miss a lot of received packets and eventually stops receiving packets at all. There is an bug in AST2600 RX logic where HW does not wrap around RX read buffer pointer correctly. Current driver workaround for this bug resets RX HW read pointer to 0 whenever it reaches end of the RX buffer ring - this does not work properly if more than 1 packet is received while RX pointer is close to the end of the RX buffer ring - in such case HW can detect ring full condition and stop RX. The new workaround has different logic: it sets HW buffer count to 4n - 1 and updates driver maintained RX write pointer so it tracks HW read pointer to prevent hardware from stopping. Received packets are located by looking into RX data buffers rather that HW read pointer that contains incorrect value anyway. Driver never resets HW read pointer, HW is receiving packets without any interference form the driver. Also handle RX_CMD_NO_MORE_INT - if RX ring if full then HW will clear RX_CMD_READY bit and we need to re-enable it once we free some space in RX ring. Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>
2021-11-05soc: aspeed: mctp: Expose internal kernel APIIwona Winiarska1-39/+73
Some protocols that are already implemented in kernel can be encapsulated in MCTP packets. To allow use aspeed-mctp internally in kernel space, let's allow to use selected functions outside of aspeed-mctp. Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com>
2021-11-05soc: aspeed: mctp: Fix header swapping consistencyIwona Winiarska1-24/+23
Right now, TX ring contains packets with PCIe header already swapped to little endian (byte order expected by HW), while RX ring contains packets with PCIe header already swapped to network order (expected by userspace). Let's keep TX packets in network order and swap before write to HW buffer. To make it more readable, let's extract swapping into a helper function. Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com>
2021-11-05aspeed-mctp: Add EID information related ioctlsKarol Wachowski1-0/+178
Implement two new ioctls for storing EID related information: * ASPEED_MCTP_IOCTL_GET_EID_INFO * ASPEED_MCTP_IOCTL_SET_EID_INFO Driver stores EID mapping in a list which is traversed when one tries to get information using ASPEED_MCTP_IOCTL_GET_EID_INFO ioctl, when given EID mapping is not found in the list, next entry is returned. When there are no entries with EIDs higher than specified in the IOCTL call -ENODEV is returned. Whenever new information about EID mapping is stored with ASPEED_MCTP_IOCTL_SET_EID_INFO ioctl driver empties exsiting list of mappings and creates new one based on user input. After insertion list is sorted by EID. Invalid input such as duplicated EIDs will cause driver to return -EINVAL. Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
2021-11-05soc: aspeed: mctp: Pick uevents consistentlyIwona Winiarska1-3/+2
Uevent objects are different for PCI_READY=0 and PCI_READY=1. Let's make uevents consistent and use the same object in both cases. Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com>
2021-11-05soc: aspeed: mctp: Add API to register client for MCTP typeAndrzej Kacprowski1-2/+198
MCTP client can register for receiving packets with selected MCTP message type or PCIE vendor defined message type. Vendor defined type is 2 bytes but in Intel VDMs the first byte is variable and only the second byte contains constant message type - to support this use case we have to specify 2 byte mask that is applied to packet type before comparing with registered vendor type. When MCTP packet arrives its header is compared with a list of registered (vendor) types. If no client registered for packet's (vendor) type then the packet is dispatched to the default client. Fragmented packets are not considered for type matching. Only one client can register for given (vendor) type. Client can register for multiple (vendor) types. All packet fields must be specified in big endian byte order. This feature allows to support multiple clients simultaneously but only one client per (vendor) message type. For example we can have PECI client in kernel that uses PECI vendor message type, dcpmm daemon in user space that handles NVDIMM vendor type messages and mctpd service that handles MCTP control and PLDM message types. tested with peci_mctp_test application Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>
2021-11-05soc: aspeed: mctp: Add IOCTL to register default clientAndrzej Kacprowski1-8/+22
Add IOCTL to register given client as default client that receives all packets that were not dispatched to other clients. This IOCTL is intended to be used by mctpd service or test application that should receive all packets that are not claimed by other clients. mctpd service might not be the first user space client since dcpmm or telemetry client can start before mctpd or mctpd can crash and be restarted automatically at any time. To preserve backward compatibility with mctpd, the first user space client will be registered automatically as default client - once mctpd is modified to call ASPEED_MCTP_IOCTL_REGISTER_DEFAULT_HANDLER we can remove this workaround. Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>
2021-11-05soc: aspeed: mctp: Move wait queue to clientAndrzej Kacprowski1-7/+5
Whenever MCTP packet arrives it is dispatched to a specific client - there is no need to wake up all clients waiting in aspeed_mctp_poll(). Move wait queue from driver structure to client structure. Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>
2021-11-05soc: aspeed: mctp: Add support for multiple clientsAndrzej Kacprowski1-104/+93
This commit adds minimal support for multiple clients. Currently packets are dispatched to default client. Support for dispatching incoming packets to different clients will be added in subsequent patches. Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>
2021-11-05soc: aspeed: mctp: Add initial driver for ast2600-mctpIwona Winiarska3-0/+1214
Currently, there is no proper MCTP networking subsystem in Linux. Until we are able to work out the details of that, we are going to expose HW to userspace using raw read/write interface. Because of that, this driver is not intended to be submitted upstream. Here we are providing a simple device driver for AST2600 MCTP controller. v2: Added workarounds for BMC reboot/reset, corrected endianess comment, changed TX_BUF_ADDR to be consistent, fixed typos. v3: Added workaround for RX hang, added swapping PCIe VDM header to network order, corrected buffer allocation size. v4: Fixed TX broken after sending 32 byte packet Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com> Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>
2021-11-05Enabling interrupt based mailboxArun P. Mohanan1-33/+69
Modifying the mailbox driver to use FIFO queue while using interrupt. Signed-off-by: Arun P. Mohanan <arun.p.m@linux.intel.com>
2021-11-05misc: Block error printing on probe defer case in Aspeed LPC ctrlJae Hyun Yoo1-4/+4
This commit adds a checking code when it gets -EPROBE_DEFER while getting a clock resource. In this case it doesn't need to print out an error message because the probing will be re-visited. Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
2021-11-05Implement a memory driver share memoryCheng C Yang3-0/+172
Implement a memory driver for BMC to access VGA share memory. The driver is used by MDRV2. In MDRV2 BIOS will send whole SMBIOS table to VGA memory and BMC can get the table from VGA memory through this driver. Signed-off-by: Cheng C Yang <cheng.c.yang@intel.com>
2021-11-05Aspeed LPC SIO driverYong Li3-0/+415
Add lpc sio device driver for AST2500/2400 Signed-off-by: Yong Li <yong.b.li@intel.com> Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
2021-11-05soc: aspeed: add lpc mbox driverJae Hyun Yoo3-0/+382
This commit adds back the lpc mbox driver which was removed from the openbmc linux dev-5.2 tree. This driver should be rewritten later. Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> Signed-off-by: Arun P. Mohanan <arun.p.m@linux.intel.com>
2021-11-03soc: aspeed: Fix UART routing driverChia-Wei Wang2-4/+15
The build changes relating to the routing driver were lost when backporting. Signed-off-by: Joel Stanley <joel@jms.id.au>
2021-11-02soc: aspeed: Add UART routing supportChia-Wei Wang1-0/+603
Add driver support for the UART routing control. Users can perform runtime configuration of the RX muxes among the UART controllers and the UART IO pins. The sysfs interface is also exported for the convenience of routing paths check and update. Signed-off-by: Oskar Senft <osk@google.com> Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com> Signed-off-by: Joel Stanley <joel@jms.id.au> Tested-by: Lei YU <yulei.sh@bytedance.com> Link: https://lore.kernel.org/r/20210927023053.6728-5-chiawei_wang@aspeedtech.com Link: https://lore.kernel.org/r/20211022000616.481772-1-joel@jms.id.au' Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2021-11-01soc: aspeed: xdma: Add reset ioctlEddie James1-0/+32
Users of the XDMA engine need a way to reset it if something goes wrong. Problems on the host side, or user error, such as incorrect host address, may result in the DMA operation never completing and no way to determine what went wrong. Therefore, add an ioctl to reset the engine so that users can recover in this situation. Signed-off-by: Eddie James <eajames@linux.ibm.com> Acked-by: Andrew Jeffery <andrew@aj.id.au> Reviewed-by: Joel Stanley <joel@jms.id.au> Link: https://lore.kernel.org/r/1588697905-23444-5-git-send-email-eajames@linux.ibm.com Signed-off-by: Joel Stanley <joel@jms.id.au>
2021-11-01soc: aspeed: xdma: Add user interfaceEddie James1-0/+217
This commits adds a miscdevice to provide a user interface to the XDMA engine. The interface provides the write operation to start DMA operations. The DMA parameters are passed as the data to the write call. The actual data to transfer is NOT passed through write. Note that both directions of DMA operation are accomplished through the write command; BMC to host and host to BMC. The XDMA driver reserves an area of physical memory for DMA operations, as the XDMA engine is restricted to accessing certain physical memory areas on some platforms. This memory forms a pool from which users can allocate pages for their usage with calls to mmap. The space allocated by a client will be the space used in the DMA operation. For an "upstream" (BMC to host) operation, the data in the client's area will be transferred to the host. For a "downstream" (host to BMC) operation, the host data will be placed in the client's memory area. Poll is also provided in order to determine when the DMA operation is complete for non-blocking IO. Signed-off-by: Eddie James <eajames@linux.ibm.com> Reviewed-by: Andrew Jeffery <andrew@aj.id.au> Reviewed-by: Joel Stanley <joel@jms.id.au> Link: https://lore.kernel.org/r/1588697905-23444-4-git-send-email-eajames@linux.ibm.com Signed-off-by: Joel Stanley <joel@jms.id.au>