summaryrefslogtreecommitdiffstats
path: root/drivers/net/ipa
AgeCommit message (Collapse)AuthorFilesLines
2020-11-28net: ipa: adjust GSI register addressesAlex Elder2-2/+30
The offsets for almost all GSI registers we use have different offsets starting at IPA version 4.5. Only two registers remain in their original location. In a way though, the new register locations are not *that* different. The entire group of affected registers has simply been shifted down in memory by a fixed amount (0xd000). So for example, the channel context 0 register that has a base offset of 0x0001c000 for "older" hardware now has a base offset of 0x0000f000. This patch aims to add support for IPA v4.5 registers at their new offets in a way that minimizes the amount of code that needs to change. It is not ideal, but it avoids the need to maintain a nearly complete set of additional register offset definitions. The approach takes advantage of the fact that when accessing GSI registers we do not access any of memory at lower end of the "gsi" memory range (with two exceptions already noted). In particular, we do not access anything within the bottom 0xd000 bytes of the GSI memory range. For IPA version 4.5, after we map the GSI memory, we adjust the virtual memory pointer downward by the fixed amount (0xd000). That way, register accesses using the offsets defined by the existing GSI_REG_*() macros will resolve to the proper locations for IPA version 4.5. The two registers *not* affected by this offset are accessed only in gsi_irq_setup(). There, for IPA version 4.5, we undo the general register adjustment by adding the fixed amount back to the virtual address to access these registers. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-28net: ipa: update gsi registers for IPA v4.5Alex Elder2-2/+21
Very few GSI register definitions change for IPA v4.5, however as a group their position in memory shifts a constant amount (handled by the next commit). Add definitions and update comments to the set of GSI registers to support changes that come with IPA v4.5. Update the logic in gsi_channel_program() to accommodate the new (expanded) PREFETCH_MODE field in the CH_C_QOS register. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-28net: ipa: add support to code for IPA v4.5Alex Elder3-23/+57
Update the IPA code to make use of the updated IPA v4.5 register definitions. Generally what this patch does is, if IPA v4.5 hardware is in use: - Ensure new registers or fields in IPA v4.5 are updated where required - Ensure registers or fields not supported in IPA v4.5 are not examined when read, or are set to 0 when written It does this while preserving the existing functionality for IPA versions lower than v4.5. The values to program for QSB_MAX_READS and QSB_MAX_WRITES and the source and destination resource counts are updated to be correct for all versions through v4.5 as well. Note that IPA_RESOURCE_GROUP_SRC_MAX and IPA_RESOURCE_GROUP_DST_MAX already reflect that 5 is an acceptable number of resources (which IPA v4.5 implements). Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-28net: ipa: add new most-significant bits to registersAlex Elder2-11/+66
IPA v4.5 adds a few fields to the endpoint header and extended header configuration registers that represent new high-order bits for certain offsets and sizes. Add code to incorporate these upper bits into the registers for IPA v4.5. This includes creating ipa_header_size_encoded(), which handles encoding the metadata offset field for use in the ENDP_INIT_HDR register in a way appropriate for the hardware version. This and ipa_metadata_offset_encoded() ensure the mask argument passed to u32_encode_bits() is constant. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-28net: ipa: update IPA registers for IPA v4.5Alex Elder3-8/+44
Update "ipa_reg.h" so that register definitions support IPA hardware version 4.5, in addition to versions 3.5.1 through v4.2. Most of the register definitions are the same, but in some cases fields are added, changed, or eliminated. Updates for a few IPA v4.5 registers are more complex, and adding those definition will be deferred to separate patches. This patch only updates the register offset and field definitions, and adds informational comments. The only code change avoids accessing the backward compatibility register for IPA version 4.5 in ipa_hardware_config(). Other IPA v4.5-specific code changes will come later. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-28net: ipa: reverse logic on escape buffer useAlex Elder1-2/+4
Starting with IPA v4.2 there is a GSI channel option to use an "escape buffer" instead of prefetch buffers. This should be used for all channels *except* the AP command TX channel. The logic that implements this has it backwards; fix this bug. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-25soc: qcom: ipa: Constify static qmi structsRikard Falkeborn1-4/+4
These are only used as input arguments to qmi_handle_init() which accepts const pointers to both qmi_ops and qmi_msg_handler. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Acked-by: Alex Elder <elder@linaro.org> Link: https://lore.kernel.org/r/20201122234031.33432-2-rikard.falkeborn@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-20net: ipa: add driver shutdown callbackAlex Elder1-2/+12
A system shutdown can happen at essentially any time, and it's possible that the IPA driver is busy when a shutdown is underway. IPA hardware accesses IMEM and SMEM memory regions using an IOMMU, and at some point during shutdown, needed I/O mappings could become invalid. This could be disastrous for any "in flight" IPA activity. Avoid this by defining a new driver shutdown callback that stops all IPA activity and cleanly shuts down the driver. It merely calls the driver's existing remove callback, reporting the error if it returns one. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-20net: ipa: retry modem stop if busyAlex Elder1-0/+5
The IPA driver remove callback, ipa_remove(), calls ipa_modem_stop() if the setup stage of initialization is complete. If a concurrent call to ipa_modem_start() or ipa_modem_stop() has begin but not completed, ipa_modem_stop() can return an error (-EBUSY). The next patch adds a driver shutdown callback, which will simply call ipa_remove(). We really want our shutdown callback to clean things up. So add a single retry to the ipa_modem_stop() call in ipa_remove() after a short (millisecond) delay. This offers no guarantee the shutdown will complete successfully, but we'll at least try a little harder before giving up. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-20net: ipa: support retries on generic GSI commandsAlex Elder2-2/+20
When stopping an AP RX channel, there can be a transient period while the channel enters STOP_IN_PROC state before reaching the final STOPPED state. In that case we make another attempt to stop the channel. Similarly, when stopping a modem channel (using a GSI generic command issued from the AP), it's possible that multiple attempts will be required before the channel reaches STOPPED state. Add a field to the GSI structure to record an errno representing the result code provided when a generic command completes. If the result learned in gsi_isr_gp_int1() is RETRY, record -EAGAIN in the result code, otherwise record 0 for success, or -EIO for any other result. If we time out nf gsi_generic_command() waiting for the command to complete, return -ETIMEDOUT (as before). Otherwise return the result stashed by gsi_isr_gp_int1(). Add a loop in gsi_modem_channel_halt() to reissue the HALT command if the result code indicates -EAGAIN. Limit this to 10 retries (after the initial attempt). Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-20net: ipa: ignore CHANNEL_NOT_RUNNING errorsAlex Elder1-1/+23
IPA v4.2 has a hardware quirk that requires the AP to allocate GSI channels for the modem to use. It is recommended that these modem channels get stopped (with a HALT generic command) by the AP when its IPA driver gets removed. The AP has no way of knowing the current state of a modem channel. So when the IPA driver issues a HALT command it's possible the channel is not running, and in that case we get an error indication. This error simply means we didn't need to stop the channel, so we can ignore it. This patch adds an explanation for this situation, and arranges for this condition to *not* report an error message. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-20net: ipa: don't reset an ALLOCATED channelAlex Elder1-2/+4
If the rmnet_ipa0 network device has not been opened at the time we remove or shut down the IPA driver, its underlying TX and RX GSI channels will not have been started, and they will still be in ALLOCATED state. The RESET command on a channel is meant to return a channel to ALLOCATED state after it's been stopped. But if it was never started, its state will still be ALLOCATED, the RESET command is not required. Quietly skip doing the reset without printing an error message if a channel is already in ALLOCATED state when we request it be reset. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-20net: ipa: print channel/event ring number on errorAlex Elder1-22/+32
When a GSI command is used to change the state of a channel or event ring we check the state before and after the command to ensure it is as expected. If not, we print an error message, but it does not include the channel or event ring id, and it easily can. Add the channel or event ring id to these error messages. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-20net: ipa: use config data for clockingAlex Elder1-20/+20
Stop assuming a fixed IPA core clock rate and interconnect bandwidths. Use the configuration data defined for these things instead. Get rid of the previously-used constants. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-20net: ipa: populate clock and interconnect dataAlex Elder2-0/+42
Populate the core clock rate and interconnect average and peak bandwidth data for SDM845 and SC7180 in their configuration data files. At this point we still don't *use* this data. Note that SC7180 actually defines a new core clock rate (100 MHz instead of 75 MHz) and new interconnect bandwidth values. They will be activated in the next commit, which uses the configured values rather than the fixed constants. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-20net: ipa: define clock and interconnect dataAlex Elder4-14/+50
Define a new type of configuration data, used to initialize the IPA core clock and interconnects. This is the first of three patches, and defines the data types and interface but doesn't yet use them. Switch the return value if there is no matching configuration data to ENODEV instead of ENOTSUPP (to avoid using the nonstandard errno). Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-19Merge https://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski1-3/+12
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-18net: ipa: a few last IPA register cleanupsAlex Elder3-18/+16
Some last cleanups for the existing IPA register definitions: - Remove the definition of IPA_REG_ENABLED_PIPES_OFFSET, because it is not used. - Use "IPA_" instead of "BAM_" as the prefix on fields associated with the FLAVOR_0 register. We use GSI (not BAM), but the fields apply to both GSI and BAM. - Get rid of the definition of IPA_CS_RSVD; it is never used. - Add two missing field mask definitions for the INIT_DEAGGR endpoint register. - Eliminate a few of the defined sequencer types, because they are unused. We can add them back when needed. - Add a field mask to indicate which bit causes an interrupt on the microcontroller. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-18net: ipa: move definition of enum ipa_irq_idAlex Elder2-16/+37
Move the definition of the ipa_irq_id enumerated type out of "ipa_interrupt.h" and into "ipa_reg.h", and flesh out its set of defined values. Each interrupt id indicates a particular type of IPA interrupt that can be signaled. Their numeric values define bit positions in the IPA_IRQ_* registers, so should their definitions should accompany the definition of those register offsets. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-18net: ipa: rearrange a few IPA register definitionsAlex Elder1-73/+74
Move a few things around in "ipa_reg.h": - Move the definition of ipa_reg_state_aggr_active_offset() down a bit in the file so definitions are ordered by offset (for the lowest supported IPA version) like all other definitions. - Move the definition TIMER_FREQUENCY to be immediately above the definition of ipa_aggr_granularity_val() where it's used. - Move each register field value enumerated type definition to immediately follow the definitions of the register and field it is associated with. No code functionality is modified by this patch. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-18net: ipa: fix up IPA register commentsAlex Elder1-11/+18
Revise or add comments in "ipa_reg.h" for to provide more information, and to improve clarity and consistency. - Always provide a comment to define when a register or field is supported (or not) for certain versions of IPA hardware. - Try to be specific about *which* or *how many* definitions a comment refers to. - Move comments stating that ipa->available defines the valid bits in various registers *above* the register offset definition, to avoid some checkpatch.pl warnings. No code is changed by this patch. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-18net: ipa: define enumerated types consistentlyAlex Elder9-77/+87
Consistently define numeric values for enumerated type members using hexidecimal (rather than decimal) format values. Align the values assigned in the same column in each file. Only assign values where they really matter, for example don't assign IPA_ENDPOINT_AP_MODEM_TX the value 0. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-18net: ipa: fix BCR register field definitionsAlex Elder1-9/+22
The backward compatibility register field masks are defined using single-bit masks defined with BIT(x) rather than GENMASK(x, x). Change this one set of definitions to follow the GENMASK() pattern used everywhere else. Add a few missing field definitions for this register as well. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-18net: ipa: use _FMASK consistentlyAlex Elder2-15/+15
Several IPA register field masks are defined without the "_FMASK" suffix naming convention. Rename these, so all field masks are consistently named. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-18net: ipa: fix two inconsistent IPA register namesAlex Elder2-11/+11
Rename two suspend IRQ registers so they follow the IPA_REG_IRQ_xxx naming convention used elsewhere. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-18net: ipa: support more versions for HOLB timerAlex Elder1-2/+2
IPA version 3.5.1 represents the timer used in avoiding head-of-line blocking with a simple tick count. IPA v4.2 changes that, instead splitting the timer field into two parts (base and scale) to represent the ticks in the timer period. IPA v4.0 and IPA v4.1 use the same method as IPA v3.5.1. Change the test in ipa_reg_init_hol_block_timer_val() so the result is correct for those versions as well. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-18net: ipa: make filter/routing hash enable register variableAlex Elder2-5/+13
For IPA v3.5.1, the IPA filter/routing hash enable register actually does exist, but it is at offset 0x8c into the IPA register space. For newer versions of IPA it is at offset 0x148. Define a new inline function ipa_reg_filt_rout_hash_en_offset() to return the appropriate value for a given version of IPA hardware. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-18net: ipa: share field mask values for IPA hash registersAlex Elder2-10/+7
The IPA filter/routing hash enable register and filter/routing hash flush register each have four single-bit fields representing the four hashed tables to be enabled or flushed. The field positions are identical, so just use a single set of field masks to represent the fields for both registers. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-16net: ipa: lock when freeing transactionAlex Elder1-3/+12
Transactions sit on one of several lists, depending on their state (allocated, pending, complete, or polled). A spinlock protects against concurrent access when transactions are moved between these lists. Transactions are also reference counted. A newly-allocated transaction has an initial count of 1; a transaction is released in gsi_trans_free() only if its decremented reference count reaches 0. Releasing a transaction includes removing it from the polled (or if unused, allocated) list, so the spinlock is acquired when we release a transaction. The reference count is used to allow a caller to synchronously wait for a committed transaction to complete. In this case, the waiter takes an extra reference to the transaction *before* committing it (so it won't be freed), and releases its reference (calls gsi_trans_free()) when it is done with it. Similarly, gsi_channel_update() takes an extra reference to ensure a transaction isn't released before the function is done operating on it. Until the transaction is moved to the completed list (by this function) it won't be freed, so this reference is taken "safely." But in the quiesce path, we want to wait for the "last" transaction, which we find in the completed or polled list. Transactions on these lists can be freed at any time, so we (try to) prevent that by taking the reference while holding the spinlock. Currently gsi_trans_free() decrements a transaction's reference count unconditionally, acquiring the lock to remove the transaction from its list *only* when the count reaches 0. This does not protect the quiesce path, which depends on the lock to ensure its extra reference prevents release of the transaction. Fix this by only dropping the last reference to a transaction in gsi_trans_free() while holding the spinlock. Fixes: 9dd441e4ed575 ("soc: qcom: ipa: GSI transactions") Reported-by: Stephen Boyd <swboyd@chromium.org> Signed-off-by: Alex Elder <elder@linaro.org> Link: https://lore.kernel.org/r/20201114182017.28270-1-elder@linaro.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-13net: ipa: ignore the microcontroller log eventAlex Elder1-1/+2
The IPA-resident microcontroller has the ability to log various activity in an area of IPA shared memory. When the microcontroller starts it generates an event to the AP to provide information about the log. We don't support reading this log, and we can safely ignore the event. So do that rather than treating the log info event we receive as "unsupported." Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-13net: ipa: fix source packet contexts limitAlex Elder1-2/+2
I have discovered that the maximum number of source packet contexts configured for SDM845 is incorrect. Fix this error. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-13net: ipa: use enumerated types for GSI field valuesAlex Elder2-10/+18
Replace constants defined with an "_FVAL" suffix with values defined in enumerated types, to be consistent with other usage in the driver. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-13net: ipa: move GSI command opcode values into "gsi_reg.h"Alex Elder2-22/+19
The gsi_ch_cmd_opcode, gsi_evt_cmd_opcode, and gsi_generic_cmd_opcode enumerated types are values that fields in the GSI command registers can take on. Move their definitions out of "gsi.c" and into "gsi_reg.h", alongside the definition of registers they are associated with. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-13net: ipa: move GSI error values into "gsi_reg.h"Alex Elder2-20/+19
The gsi_err_code and gsi_err_type enumerated types are values that fields in the GSI ERROR_LOG register can take on. Move their definitions out of "gsi.c" and into "gsi_reg.h", alongside the definition of the ERROR_LOG register offset and field symbols. Drop the "_ERR" suffix in the names of the gsi_err_code members. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-13net: ipa: move channel type values into "gsi_reg.h"Alex Elder2-8/+8
The gsi_channel_type enumerated type define values used for the channel type/protocol for event rings and channels. Move its definition out of "gsi.c" and into "gsi_reg.h", alongside the definition of the CH_C_CNTXT_0 register offset and its fields. Add a comment near the definition of the EV_CH_E_CNTXT_0 register indicating this type is used for its EV_CHTYPE field. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-13net: ipa: use common value for channel type and protocolAlex Elder1-17/+10
The numeric values that represent the event ring channel type are identical to the values that represent the matching protocol used for a channel. Use a new gsi_channel_type enumerated type to represent the values programmed for both cases, using "CHANNEL_TYPE" in member names in place of "EVT_CHTYPE" and "CHANNEL_PROTOCOL". Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-13net: ipa: define GSI interrupt types with enumsAlex Elder2-20/+25
Define the GSI global interrupt types with an enumerated type whose values are the bit positions representing the global interrupt types. Similarly, define the GSI general interrupt types with an enumerated type whose values are the bit positions of general interrupt types. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-11net: ipa: drop an error messageAlex Elder1-6/+1
There is no need for gsi_modem_channel_halt() to report an error, because gsi_generic_command() will already have done that if the command times out. So get rid of the extra message. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-11net: ipa: change a warning to debugAlex Elder1-4/+4
When we determine from hardware what the size of IPA memory is we compare it against what we learned about it from DT. If DT defines a region that's larger than actual memory, we use the smaller actual size and issue a warning. If DT defines a smaller region than actual memory we issue a warning too. But in this case the difference is harmless; so rather than issuing a warning, just provide a debug message instead. Reorder these checks so the one that matters more is done first. Reported-by: Stephen Boyd <swboyd@chromium.org> Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-11net: ipa: get rid of a useless line of codeAlex Elder1-2/+1
Delete a spurious line of code in ipa_hardware_config(). It reads a register value then ignores the value, so is completely unnecessary. Add a missing word in a comment. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-11net: ipa: don't break build on large transaction sizeAlex Elder1-3/+0
The following call in ipa_validate_build() is erroneous: BUILD_BUG_ON(sizeof(struct gsi_trans) > 128); The fact is, it is not a bug for the size of a GSI transaction to be bigger than 128 bytes. The correct operation of the driver is not dependent on the size of this structure. The only consequence of the transaction being large is that the amount of memory required is larger. The problem this was trying to flag is that a *slight* increase in the size of this structure will have a disproportionate effect on the amount of memory used. E.g. if the structure grew to 132 bytes the memory requirement for the transaction arrays would be about double. With various debugging build flags enabled, the size grows to 160 bytes. But there's no reason to treat that as a build-time bug. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-07net: ipa: pass a value to gsi_irq_type_update()Alex Elder1-18/+13
Now that all of the GSI interrupts are handled uniformly, change gsi_irq_type_update() so it takes a value. Have the function assign that value to the cached mask of enabled GSI IRQ types before writing it to hardware. Note that gsi_irq_teardown() will only be called after gsi_irq_disable(), so it's not necessary for the former to disable all IRQ types. Get rid of that. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-07net: ipa: only enable GSI general IRQs when neededAlex Elder2-5/+10
Most GSI general errors are unrecoverable without a full reset. Despite that, we want to receive these errors so we can at least report what happened before whatever undefined behavior ensues. Explicitly disable all such interrupts in gsi_irq_setup(), then enable those we want in gsi_irq_enable(). List the interrupt types we are interested in (everything but breakpoint) explicitly rather than using GSI_CNTXT_GSI_IRQ_ALL, and remove that symbol's definition. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-07net: ipa: explicitly disallow inter-EE interruptsAlex Elder1-2/+2
It is possible for other execution environments (EEs, like the modem) to request changes to local (AP) channel or event ring state. We do not support this feature. In gsi_irq_setup(), explicitly zero the mask that defines which channels are permitted to generate inter-EE channel state change interrupts. Do the same for the event ring mask. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-07net: ipa: only enable GSI IEOB IRQs when neededAlex Elder1-5/+11
A GSI channel must be started in order to use it to perform a transfer data (or command) transaction. And the only time we'll see an IEOB interrupt is if we send a transaction to a started channel. Therefore we do not need to have the IEOB interrupt type enabled until at least one channel has been started. And once the last started channel has been stopped, we can disable the IEOB interrupt type again. We already enable the IEOB interrupt for a particular channel only when it is started. Extend that by having the IEOB interrupt *type* be enabled only when at least one channel is in STARTED state. Disallow all channels from triggering the IEOB interrupt in gsi_irq_setup(). We only enable an channel's interrupt when needed, so there is no longer any need to zero the channel mask in gsi_irq_disable(). Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-07net: ipa: only enable generic command completion IRQ when neededAlex Elder2-9/+27
The completion of a generic EE GSI command is signaled by a global interrupt of type GP_INT1. The only other used type for a global interrupt is a hardware error report. First, disallow all global interrupt types in gsi_irq_setup(). We want to know about hardware errors, so re-enable the interrupt type in gsi_irq_enable(), to allow hardware errors to be reported. Disable that interrupt type again in gsi_irq_disable(). We only issue generic EE commands one at a time, and there's no reason to keep the completion interrupt enabled when no generic EE command is pending. We furthermore have no need to enable the GP_INT2 or GP_INT3 interrupt types (which aren't used). The change in gsi_irq_enable() makes GSI_CNTXT_GLOB_IRQ_ALL unused, so get rid of it. Have gsi_generic_command() enable the GP_INT1 interrupt type (in addition to the ERROR_INT type) only while a generic command is pending. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-07net: ipa: only enable GSI event control IRQs when neededAlex Elder1-7/+20
A GSI event ring causes an event control interrupt to fire whenever its state changes (between NOT_ALLOCATED and ALLOCATED). No event ring should ever change state except when we request it to. Currently, we permit *all* events rings to generate event control interrupts--even those that are never used. And we enable event control interrupts essentially at all times, from setup to teardown. Instead, only enable the event control interrupt type for the duration of an event ring command, and when doing so, only allow the event ring being operated upon to cause the interrupt to fire. Disallow all event rings from issuing the event control interrupt in gsi_irq_setup(). Because an event ring's interrupt is only enabled when needed, there is no longer any need to zero the event channel mask in gsi_irq_disable(). Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-07net: ipa: only enable GSI channel control IRQs when neededAlex Elder1-7/+32
A GSI channel causes a channel control interrupt to fire whenever its state changes (between NOT_ALLOCATED, ALLOCATED, STARTED, etc.). We do not support inter-EE channel commands (initiated by other EEs), so no channel should ever change state except when we request it to. Currently, we permit *all* channels to generate channel control interrupts--even those that are never used. And we enable channel control interrupts essentially at all times, from setup to teardown. Instead, disable all channel control interrupts initially in gsi_irq_setup(), and only enable the channel control interrupt type for the duration of a channel command. When doing so, only allow the channel being operated upon to cause the interrupt to fire. Because a channel's interrupt is now enabled only when needed (one channel at a time), there is no longer any need to zero the channel mask in gsi_irq_disable(). Add new gsi_irq_type_enable() and gsi_irq_type_disable() as helper functions to control whether a given GSI interrupt type is enabled. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-07net: ipa: cache last-saved GSI IRQ enabled typeAlex Elder2-12/+24
Keep track of the set of GSI interrupt types that are currently enabled by recording the mask value to write (or last written) to the TYPE_IRQ_MSK register. Create a new helper function gsi_irq_type_update() to handle actually writing the register. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-07net: ipa: disable all GSI interrupt types initiallyAlex Elder1-10/+32
Introduce gsi_irq_setup() and gsi_irq_teardown() to disable all GSI interrupts when first setting up GSI hardware, and to clean things up when we're done. Re-enable all GSI interrupt types in gsi_irq_enable(), but do so only after each of the type-specific interrupt masks has been configured. Similarly, disable all interrupt types in gsi_irq_disable()--first--before zeroing out the type-specific masks. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>